Reputation: 135
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?
Upvotes: 6
Views: 3373
Reputation: 377
let rootControllerIdentifier = "FirstInputInterfaceController"
WKInterfaceController.reloadRootControllers(withNames: [rootControllerIdentifier], contexts: nil)
let rootControllerIdentifier = "FirstInputInterfaceController"
WKInterfaceController.reloadRootControllers(withNamesAndContexts: [(name: rootControllerIdentifier, context: [:] as AnyObject)])
Upvotes: 8
Reputation: 135
After long research work I found only one solution - create some SplashController, with some splash screen, and in
override func awakeWithContext(context: AnyObject?) {
super.awakeWithContext(context)
}
track something that you need, after track present some controllers, example
if !isCounting {
self.presentControllerWithName("Interface", context: nil)
} else {
self.presentControllerWithName("Timer", context: nil)
}
hope it will help someone. P.S. isCounting is stored in NSUserDefaults
Upvotes: 1