- (void)awakeWithContext:(id)context {
[super awakeWithContext:context];
[WKInterfaceController reloadRootControllersWithNames:@[@\"pageOne\", @\"pageTwo\"] cont
calling WKInterfaceController.reloadRootControllers causes the awake function to be called a second time. This is the solution I use - it is straight forward, compact, and eliminates the recursive loop. This example has two page based views called mainControls and nowPlaying that are configured with contexts. Note the key thing here is to configure the mainControls view controller with an empty string context then that context is checked and returns if it is being called again due to the WKInterfaceController.reloadRootControllers statement that configured the context to "". Note the first time awake runs the context for the main view controller will be nil. Also note the second context is an implementation detail specific to my implementation - this could be any object that you want to pass to the second view controller.
override func awake(withContext context: Any?) {
super.awake(withContext: context)
if let _ = context as? String {
print("already configured!")
return
}
print("configuring...")
WKInterfaceController.reloadRootControllers(withNames: ["mainControls", "nowPlaying"], contexts: ["", interaction])
}