0

If I call:

someButton.setHidden(true)
someButton.setHidden(false)
someButton.setHidden(true)

Is it guaranteed that button will be hidden now?

I know that in watchOS 1, these messages would be sent from iPhone to Watch, but in watchOS 2 it should run on the same device - but given that there is no way to check if object is hidden, I have doubts about what's guaranteed.

Thanks

Vojto
  • 6,901
  • 4
  • 27
  • 33

1 Answers1

2

The button will be hidden, since true is the last value which will take effect.

From the WKInterfaceObject Class Reference:

WatchKit coalesces the data from all setter method calls made during the same run loop iteration and transmits it to the device at the end of the run loop. If you set an attribute to different values in the same run loop iteration, only the last value is transmitted.

The button will never be hidden, shown, then hidden again, as the previous messages do not get applied by the run loop. Only the last of those messages has any effect, and only one update is made to the button.