Xcode 7 has some great new features one of those is handling busy storyboards that often occur with big or complicated applications. Now you have the ability to move related views to a separate storyboard file and reference that storyboard as needed. This allows you to group similar content giving a clearer picture, lets take a look at how it works.
There is also a video version of this tutorial available
Combine several storyboards into a separate file
1. Select some connected storyboards
Go to the menu and choose Editor > Refactor to Storyboard
Enter a new file name for the storyboard
Selected storyboards are removed from the original storyboard and put in the new file
- The original storyboard now has a storyboard reference to the new file
Note that you can either open the storyboard file to edit the contents or you can double click on the reference created in the main storyboard to open the file.
Now let’s take a look at a way to link from our new storyboard back to the main one.
Creating a link to another storyboard
1. Drag the Storyboard Reference object from the library to the open storyboard
- Create a button on viewController and right click drag to the Storyboard Reference
- In the Storyboard Reference attributes inspector select the storyboard you want to link to in the Storyboard dropdown i.e. ‘Main’
Other entries you can put in the attributes are
This gives you the option to enter a controller name, if you leave it empty then by default it will use the controller specified in the storyboard configuration.
If you have your storyboard in a separate framework then you specify that name here so the compiler knows where to find the referenced storyboard. Again, leaving it blank defaults to the default bundle assuming the storyboards are in the same bundle. So I think you can see that this new feature might seem minor at first but can become a big time and productivity saver when you have a lot of layouts to manage. Another thing to consider is the linking to a bundle, this means you can easily have your own framework of standard screens and just link to them giving consistency and easy updating across a range of applications.