Search code examples
iosobjective-cwatchkitapple-watchwatchos-2

Getting the background color of a WKInterfaceGroup programmatically (WatchKit)


How can you programmatically get the background color of a WKInterfaceGroup object?

You can set the value using

- (void)setBackgroundColor:(nullable UIColor *)color;

but can you also get it?


Solution

  • It doesn't look like there is a way to GET the background Color.

    I've never used any WatchKit stuff before, but after looking at the WKInterfaceGroup class and reading up on it a little bit, here is my understanding of how WatchKit appears to work.

    It looks like Apple wants communication (at least in the scope of the files I've looked at) to be one way. That is, they don't want you to retrieve things like that from the watch to the app level. They want you to tell the watch what to do, and the watch only receives these things (like color, inset, corner radius, etc.)

    This is the conclusion I have come to (not sure if I'm right). Now, if you NEED to get the background color from the WKInterfaceGroup, then you can keep trying to find a solution. I do not know if it is possible. What I would recommend is trying to find an alternate solution to needing this property from WKInterfaceGroup.