I would like to have two storyboard files for feature flag reasons. Only one will be used at a time, but I want to have two files for switching back and forth between builds. However, I cannot find where watchOS determines which storyboard file to load.
iOS has a key UIMainStoryboardFile
in Info.plist. But watchOS has no such key.
When I check our current Watch Extension and Watch App targets in both the General and Info sections, I see no mention of storyboard files.
Note that watchOS does have WKExtensionDelegateClassName
key for Info.plist, which will also serve my feature flag purpose. However, no code in my WKExtensionDelegate
specifies a particular storyboard.
In Xcode, when I look at the current watch storyboard file in the File Inspector right pane, I see no special indicator marking for initial storyboard. Just in case it was listed there.
The App Programming Guide for watchOS does not explain how the connection is made either.
Any ideas?
So after much experimenting:
WKInterfaceController
by name, watchOS just picks the right storyboard.Building watchOS app extension fails with errors if more than one interface controller is designated "Is Initial Controller" across multiple storyboards. The error is:
Multiple main entry points were specified. Please designate a single interface controller as the entry point of your watch application.
I devised the following scenario and it worked:
WKInterfaceController.reloadRootControllers(withNames: ["Sue"], contexts: nil)