Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

change initial interface controller in watchKit

I have two interface controllers, controller1.swift and controller2.swift

These are connected with push-segue (after button action). But in some cases I need to skip controller1 and show just controller2. In iOS app I do this in appDelegate, setting rootViewcontroller, etc. What is the way to do this in Apple Watch Extension?

any guides or help?

like image 762
Pavel Zagorskyy Avatar asked Jun 11 '15 11:06

Pavel Zagorskyy


1 Answers

let rootControllerIdentifier = "FirstInputInterfaceController"

WKInterfaceController.reloadRootControllers(withNames: [rootControllerIdentifier], contexts: nil)

Swift 4:

let rootControllerIdentifier = "FirstInputInterfaceController"
WKInterfaceController.reloadRootControllers(withNamesAndContexts: [(name: rootControllerIdentifier, context: [:] as AnyObject)])
like image 101
user3772661 Avatar answered Sep 18 '22 13:09

user3772661