In my storyboard I have´t got any view like initialViewController but I have storyboard, I want choose that depends if is Logged or not for example.
I have in the AppDelegate
func application(application: UIApplication, didFinishLaunchingWithOptions: [NSObject: AnyObject]?) -> Bool
{
let storyboard = UISToryboard(name: "Main", bundle: nil)
if isLogged{
//Access to DatesViewController
let vc = storyboard.instantiateViewControllerWithIdentifier("dates")
self.window?.rootViewController?.presentViewController(vc, animated:true,completion: nil)
}else{
//Access to LoginViewController
let vc = storyboard.instantiateViewControllerWithIdentifier("login")
self.window?.rootViewController?.presentViewController(vc, animated:true,completion: nil)
}
self.window?.makeLeyAndVisible()
return true
I don´t know how to do that, there is very much information for objetiveC but no for Swift.
This don´t work the error is: *
Failed to instantiate the default view controller for UIMainStoryBoardFile 'Main' -perhaps the designated entry point is not set?
*
If you can help me please Thanks!
This work:
func application(application: UIApplication, didFinishLaunchingWithOptions: [NSObject: AnyObject]?) -> Bool
{
let storyboard = UISToryboard(name: "Main", bundle: nil)
if isLogged{
//Access to DatesViewController
var vc = self.window?.rootViewController?.storyboard?.instantiateViewControllerWithIdentifier("dates")
self.window?.rootViewController = vc
}else{
//Access to LoginViewController
var vc = self.window?.rootViewController?.storyboard?.instantiateViewControllerWithIdentifier("login")
self.window?.rootViewController = vc
}
self.window?.makeLeyAndVisible()
return true