Storyboards vs XIBs

mainThe concept of storyboarding was introduced by Apple in iOS 5. This was the first major deviation from using the interface builder to build iOS apps. Storyboards were created to help developers visualize the flow of the application. It is a lot like having a bunch of XIBs, but in a single file. You can also create custom transitions via code that will change dynamically if needed, much like you can with XIBs. But a lot of people who are new to iOS development get confused between XIBs and Storyboards. What should you use for your project? Does it matter one way or the other?  

Here are the pros and cons of using storyboards:

PROS

  • You can mock up flow of an application without writing any code (or very minimal amount of code).
  • Storyboards are nice for apps with a small to medium number of screens and relatively straightforward navigation between views.
  • It is much easier to see your transitions between screens and your application flow.
  • You can also use XIBs with storyboards, if needed.

CONS

  • Only works with iOS 5+. Does not work with iOS 4.
  • It can get cluttered easily if you have a very view intensive application. If you have lots of views and a lot of cross-navigation between them, then the Storyboard view gets confusing and too much work will be required to keep it clean.
  • For a large project with multiple developers, it is not recommended to use Storyboards because you have a single file for your UI and the developers cannot easily work in parallel.
  • You still need XIBs in your Storyboard projects. For example, you need to use XIBs for custom table cells.

It might be worth for large apps to split up into multiple storyboard files. We can do segues between storyboards and keep them separated. There really isn’t a right or wrong when to use one or the other, it is just a matter of preference and what iOS versions you are targeting. Storyboards are a step in the right direction for the UI implementation and the hope is that Apple will extend them in the future iOS versions. It will be great if they resolve the “single file” issue. Otherwise, they will not be ideal for larger projects.

————————————————————————————————-

One thought on “Storyboards vs XIBs

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s