Reputation: 442
My segue is returning with an error (unwrapping an optional value) from this line > self.navigationController?....
In my code...
let nextScreen = self.storyboard!.instantiateViewControllerWithIdentifier("onboarding-what") as? ViewController
self.navigationController?.pushViewController(nextScreen!, animated: true)
This above code is implemented in my onboarding-start view controller
This is my storyboard set up...
the last view controller has the id of "onboarding-what".
I've read the documentation for the navigation controller but can't seem to find my problem. Does anyone have a solution?
Upvotes: 1
Views: 273
Reputation: 616
You can use performSegueWithIdentifier rather than pushViewController if you connected them in storyboard
However did you fill "onboarding-what" in the storyboardId field? pls check this image
Also "onboarding-what" view controller should be instance of ViewController (There's not default class called "ViewController" only "UIViewController" or "NSViewController" for osX.)
Upvotes: 1
Reputation: 21808
Obviously nextScreen
is nil. It is most likely that "onboarding-what"
identifier is incorrect
Upvotes: 1