Refactoring the Storyboard
In programming, the term refactor means to take your existing code and improve on it without changing its behavior. We can apply refactoring to storyboards. We are going to refactor our storyboard so that each tab in our app will have its own storyboard file.
We will be using what is called
storyboard reference, which is to add references between storyboards. A storyboard reference in one storyboard can point to an area in a different storyboard. This gives us a way to better organize our storyboards, rather than having one massive storyboard with which to work. Open your Main.storyboard
file.
Creating a New Storyboard for the Explore Tab
In
Main.storyboard
, you are going to click on and drag over all of the scenes that are in the Explore tab. Note that when you click, make sure you are not clicking any scene or View Controller.You should now see the following:
With the scenes selected, navigate to Editor | Refactor to Storyboard:
You will be prompted to name the storyboard...