Reputation: 37349
In my WatchKit app I need to display one of two interface controllers depending on the state of the containing iOS app. Neither Page-Based nor Hierarchical interfaces suit my needs.
In UIKit I can change rootViewController
of the window. Can I do similar trick in the WatchKit?
Is there a way to programmatically switch to a different interface controller without animation and make it the "initial controller"?
Upvotes: 2
Views: 1191
Reputation: 377
let rootControllerIdentifier = "FirstInputInterfaceController"
WKInterfaceController.reloadRootControllers(withNames: [rootControllerIdentifier], contexts: nil)
Upvotes: 4
Reputation: 1108
If there are only 2 Interface Controllers in your app, then you can use Groups, and show one group at a time, and hide other based on your conditions.
At run-time, the only way to modify the arrangement of items is to show/hide elements that you already added using interface builder.
Hope this helped.
Upvotes: 3