I have a Glance and some WKInterfaceLabels. I use setHidden() on them in override func willActivate() depending on some conditions.
class GlanceController: WKInterfaceController {
@IBOutlet weak var lName: WKInterfaceLabel!
...
override func willActivate() {
// This method is called when watch view controller is about to be visible to user
super.willActivate()
if(conditions) {
lName.setHidden(false)
} else {
lName.setHidden(true)
}
}
}
This works in simulator but on actual watch, I get fatal error: unexpectedly found nil while unwrapping an Optional value at lName.setHidden().
Anyone saw this before?
It appears that you are not allowed to use
.setHidden()inGlance, at least for the current version ofWatchKit.I redesign my UI completely to use a single label and it works. Obviously it does not look as nice as I intend.
I understand the restriction but really hope there is more documentation to save the trouble. Just like I only found out I can't scroll in
Glanceafter spending time designing the UI.