Language: Swift 3
OS: iOS 9+

Before iOS 9 came out, to hop from one storyboard to another, you would have to write a few lines of code similar to this:

The code from goToStoryboardOldSchoolWay.swift:

  1. Get a reference to the storyboard you want to go to. In this case, named AccountCreation.
  2. Instantiate the initial view controller named CreateAccountViewController.
  3. Present the view controller.

Once iOS 9 was delivered, there was this cool UI view element that can be added to transition from one storyboard to another called Storyboard Reference. As you can see in the text, it is a placeholder for a view controller that is located in another storyboard:

Assuming you have your initial storyboard, you’ve created another storyboard that has a view controller set as the initial view controller, and you want to get to it; follow these next couple of steps to reference it to your next storyboard as I did for the current project:

  1.  Drag a Storyboard Reference onto the storyboard editor
  2. Select the Storyboard Reference, open the Attributes Inspector, and enter/select the name of the the next storyboard
  3. Create a segue to the Storyboard Reference so the program knows what action will invoke the segue. For instance, when you press the ‘Create an Account’ button, it should segue to the AccountCreation.storyboard

You should see something like this in the end:

That’s pretty much it. Now test it to see if you can use the Storyboard Reference to hop from one storyboard to another. Also, a friend of mine asked about backwards compatibility. At the time of this writing, only about 3% of users are using something below version 9.0; so I wouldn’t be too worried.

Happy coding!

Back To Top