Can I use IBInspectable at the watchKit ? When I mark a string as IBInspectable, I can see and set it at the relevant watchKit App storyboard, but when I set it, it actually does nothing.
You can't, because for WatchKit they are Interface Objects instead of Views. Apple intentionally uses different terms for them because they are fundamentally different things.
Interface Objects are proxy objects to those actual views in the actual watch app (not your WatchKit Extension). They communicate through WatchKit via Bluetooth to actually manipulate corresponding properties of those actual views on the watch display.
When you set the text of a WKInterfaceLabel
, all it does is just to record the change you want to make, then send the changes with other changes in the run loop to the watch as a batch. The Watch OS will take all the information from those proxy objects and actually change the text on the UILabel
on the Watch.
Therefore, IBDesignable and IBInspectable won't really work here. Although they are represented in a similar way in Interface Builder, they are really different things.
In my experience, you can mark properties as IBInspectable and the property will show up in the inspector panel of interface builder. However, as you've noted, it doesn't appear that those values are populated by WatchKit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With