Storyboarding was first introduced in iOS 5 which saves a lot of time building user interfaces. It is a container for all scenes (View Controllers, Navigation Controllers, TabBar Controllers, etc). Storyboards are edited with Xcode’s Interface Builder, where we add objects to it and create outlets to link them in our code.
Pros and Cons
- Storyboards are available for iOS 5 and above. If you want to submit an app compatible for versions prior iOS 5, you can’t do it mainly because you have to set your target to use storyboards.
- Storyboards give us a complete look at the flow of our application that we can never get from individual nib files.
- Using xibs we can enabled or disable Auto Layout on a per xib basis, allowing for a mix within our application, while Storyboards apply our choice to all views it contain.
- Storyboards are nice for apps with a small to medium number of screens and relatively straightforward navigation between views.
- Storyboards fail at runtime, not at compile time.
- Storyboards make working in a team harder because we usually only have one huge storyboard file for a project. Having multiple developers making changes to one file can be a headache. The changes can be merged easily, but when a conflict occurs, it is hard to resolve it.
Apple recommends using storyboards in apps, however the choice is dependent on the following factors:
- Personal preference
Developers with years of experience in iOS tend to use NIB while the newbies prefer Storyboards. It is simply because the developers didn’t have much choice and as we know most of the software engineers start with something new.
- Single VS Team Work
If someone works alone, he/she will prefer to use programmatic UI for simple projects and NIBs for more complex ones. If it’s teamwork, people prefer to develop it with storyboards.
- Backward Compatibility
There are still many customers and clients using their old iPhones / iPads running on iOS 4.3 and older. This is one of the major reasons for using NIB. It also offers the possibility to expand the app to a greater audience.