Harish
Harish

Reputation: 1408

Add multiple storyboards in project - Swift

How do you create multiple storyboards in the same project using Swift? I know I have to go to File -> New -> File and then choose Storyboard, but how do I integrate that storyboard into my project and navigate to the new storyboard's views in Swift code?

Upvotes: 7

Views: 3087

Answers (1)

nsinvocation
nsinvocation

Reputation: 7637

You need to get a reference to the desired storyboard

let aStoryboard = UIStoryboard(name: "storyboardName", bundle: nil)

Then instantiate desired view controller

let vc = aStoryboard.instantiateViewControllerWithIdentifier("viewControllerIdentifier") as! UIViewController

Upvotes: 2

Related Questions