The life cycle of watchOS applications is described below.
awakeWithContext
When the page is initialized, awakeWithContext is awakeWithContext . This is the first method to be called, and until the UI is displayed.
You should do something like updating model arrays to present tables, set properties, etc. in awakeWithContext . This method has very similar work with initializers in simple classes ( init() ), but this time in WKInterfaceController s.
The answer to your first question:
awakeWithContext will be called on ALL PAGES as soon as watchOS applications are launched.
willActivate
When the interface controller is displayed, willActivate will be called.
You must update the values โโof labels, actions, and everything related to the elements of the view.
The answer to the second question:
willActivate will be called on ALL PAGES as soon as the watchOS application but unlike awakeWithContext , it will be called again as soon as you see the controller (in other words, when you go to this desired interface).
The first time you run the application, all โ didDeactivate controllers except the current willActivate will be called, and when you switch to another, it willActivate will be called before willActivate is called on the first.
So the life cycle:
1- awakeWithContext all views
2- willActivate all views
3- didDeactivate all views except the first (current)
And when scrolling to the second:
1- willActivate second view
2- didDeactivate first view