7

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?

marcelosalloum
  • 3,481
  • 4
  • 39
  • 63

1 Answers1

1

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 :)

Ketan Parmar
  • 27,092
  • 9
  • 50
  • 75