IBInspectable & watchkit

Can I use IBInspectable in watchKit? When I mark the line as IBInspectable, I see and set it in the appropriate watchKit app storyboard, but when I install it, it actually does nothing.

+3


source to share


2 answers


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 proxies for these actual views in a real clock application (not in your clock extension). They interact through WatchKit via Bluetooth to actually manipulate the corresponding properties of these actual representations on the watch display.



When you set the text WKInterfaceLabel

, all it does is just record the change you want to create, and then push the changes with other run loop changes to the clock as a batch. The Watch operating system will extract all information from these proxy objects and actually change the text in UILabel

the Watch.

Therefore IBDesignable and IBInspectable don't really work. Although they are presented in a similar way in Interface Builder, they are really different things.

+7


source


In my experience, you can mark properties as IBInspectable and the property will appear in the inspector panel of the interface designer. However, as you noticed, these values ​​don't appear to be populated by WatchKit.



+2


source







All Articles