Passing Data Between Interfaces
To navigate directly to the Run Log page when a run is done, we need to call the becomeCurrentPage of our RunLogInterfaceController. When we go back to it by calling reloadRootControllersWithNames(_:contexts:), we’re just passing the name of the controller to WKInterfaceController. We don’t get back any references to the newly created interface controllers, so how can we call becomeCurrentPage?
One approach might be to use NSNotificationCenter. After we reload the controllers, we could send a notification with a short delay, then listen for that notification in our RunLogInterfaceController and call becomeCurrentPage. That would probably work, but there’s a better way. Remember the contexts parameter we were ...
Get Developing for Apple Watch now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.