I'm setting the rootViewController of the window programatically, like this (didFinishLaunchingWithOptions
under AppDelegate
's application
method):
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let rootViewController = storyboard.instantiateViewControllerWithIdentifier("loginScreen")
window = UIWindow(frame: UIScreen.mainScreen().bounds)
window?.makeKeyAndVisible()
if let window = window {
window.rootViewController = rootViewController
}
Am I still required to go in the Interface Builder and set that controller as initial view controller? I get Failed to instantiate the default view controller for UIMainStoryboardFile 'Main' - perhaps the designated entry point is not set?
If I set an entry point I have no problem and the error disappears. I want to know what is the correct way of programatically loading views. It's weird to set the rootViewController both programatically and by interface builder. Note that I am a beginner.