The problem with a single storyboard is that they become complex for larger projects. It is also difficult to maintain and also the source control part becomes a headache as well. Storyboard references are going to be helpful when you want to divide your views betweens storyboards and avoid all these issues.
How to use storyboard references?
- Create a new project (Single view application).
- Create a new storyboard file and name it
- Now, create a new ViewController inside the
Secondstoryboard and name it
Now Click on the (+) Library and search for Storyboard Reference.
Now drag and drop
Storyboard Reference into the
Main.StoryBoard . Now, in the attributes inspector, select the Second.Storyboard from Storyboard dropdown and set the
Reference ID as the
Storyboard ID of the
And now, we can create a segue from
FirstViewController to this Storyboard reference for
Second.Storyboard and this will work as a normal segue. Here, I have added a
FirstViewController and added a Segue to the storyboard reference.
That’s it. It simply works!!!
Note: Storyboard references were introduced in iOS 9 and macOS 10.11.
If you enjoyed reading this post, please share and give some claps so others can find it 👏👏👏👏👏 !!!!
If you have any comment, question, or recommendation, feel free to post them in the comment section below!