marcelosalloum
marcelosalloum

Reputation: 3531

Set rootInterfaceController in Apple Watch's "ExtensionDelegate"

I am making a Apple Watch app and I'd like to set different root view controllers, depending on an initial condition.

I cannot set the WatchKit rootInterfaceController directly though, because it is a readonly property, but by checking Apple documentation, they say it is possible to set it "before the launch sequence finishes".

Do you have a good suggestion to do that? Maybe through the storyboard?

Upvotes: 7

Views: 371

Answers (1)

Ketan Parmar
Ketan Parmar

Reputation: 27448

You can't set read only property, you can do something like,

Create some SplashController, with some splash screen, and in awakeWithContext

 override func awakeWithContext(context: AnyObject?) {
      super.awakeWithContext(context)
 }

track something that you need, after track present some controllers, for example

   if !isCounting {
    self.presentControllerWithName("Interface", context: nil)
} else {
    self.presentControllerWithName("Timer", context: nil)
}

isCounting is stored in NSUserDefaults

hope this will help :)

Upvotes: 1

Related Questions