user4509200
user4509200

Reputation:

Cannot transition

So, I've been playing around with Sprite Kit and Swift stuff, and I was trying to transition between a game scene and a regular UIVewController when I encountered an issue. It returns an error when the actual program is run. Here is my code:

var mainStoryboard = UIStoryboard(name: "Main.storyboard", bundle: nil)
var vc = mainStoryboard.instantiateViewControllerWithIdentifier("menu") as! UIViewController
self.view!.window?.rootViewController?.presentViewController(vc, animated: true, completion: nil)

Here is the error:

Could not find a storyboard named 'Main.storyboard' in bundle NSBundle //bundle location here... (irrelevant)

Does anybody know why this isn't working? When I look at the view on the left of the screen, I see that the storyboard file's name is "Main.storyboard". Did I do something blatantly wrong?

Any help is appreciated! Thanks in advance!

Upvotes: 0

Views: 33

Answers (1)

Dániel Nagy
Dániel Nagy

Reputation: 12015

The name of the storyboard is simply "Main" instead of "Main.storyboard". From the documentation:

The name of the storyboard resource file without the filename extension. This method raises an exception if this parameter is nil.

Upvotes: 1

Related Questions