What are the main differences between using Storyboards and xib files.
Specifically, what are the advantages or disadvantages of using a Storyboard?
Unfortunately, despite doing quite a bit of research, all I've been able to find on Storyboards are simple tutorials that show you how to set up a Storyboard, instead of concrete information explaining what they are.
Storyboards - this is a visual tool for laying out multiple application views and the transitions between them (segues). XIBs (or NIBs) - each XIB file corresponds to a single view element and can be laid out in the Interface Builder, making it a visual tool as well.
Storyboards are an exciting feature first introduced in iOS 5, which save time building user interfaces for your apps. Storyboards allow you to prototype and design multiple view controller views within one file, and also let you create transitions between view controllers.
Storyboard Advantages over SwiftUIIt is easier to use Storyboard as a beginner . Storyboard consist of Xib and custom View which can be reusable in the projects. It is easier to build an app as there is only drag and drop of the elements of the storyboard.
In fact, the acronym "NIB" comes from "NeXTSTEP Interface Builder", and "XIB" from "Xcode Interface Builder". NIBs and XIBs are effectively the same thing: XIBs are newer and are used while you're developing, whereas NIBs are what get produced when you create a build.
A Storyboard is:
I have been using Storyboards for awhile now and the ONLY downside is that you can't target iOS 4 or below. Storyboards only work on devices running iOS 5 or better. Other than that, the benefits are many and the downsides are non-existent IMO.
The best tutorial I have seen is Ray Wenderlich's
Also, if you are a member of the Apple Developer program, check out last years WWDC session on Storyboards (iTunesU), it is awesome.
Another great one (also on iTunesU) is the latest Stanford iOS Application Programming course.
There are not only pro sides of Storyboarding, also cons - just because you asked for input:
-The following is not true: - if you need to do things SB doesn't offer, it's not quite easy to get SB mixed with programatical created views (well, it is possible though)
The rule of thumb seems to be: the more complex you expect your project to get, the more you'll better not go for SB.
EDIT: - another disadvantage of SB: working around all the annoying bugs of XCode regarding SB. E.g. having to frequently flush the DerivedData folder because of several inconsistencies. Sometimes storyboard files or the link to them get corrupted. Then you might have the joy to search for the problem. Take a look at this thread to get the idea
EDIT 2 (March 2013): meanwhile Storyboards and Xcode are working much better, and documentation and best practices are wide spread. I think working with storyboard can be recommended for a majority of projects, even if there are still some glitches.
EDIT 3 (Sept 2013): now with the new Xcode 5 format working in teams with SB might get even better, as it seems to become possible to merge SB-code much easier now.
Another EDIT: well, if you have an hour of time, sit back, relax and listen to these guys discussing this topic (Ray Wenderlich & Co)
Edit 2016.1: after a long time being a Storyboard advocate, I had so much hassle with it the last months, that I decided to abandon Storyboards as far as possible. The reason for that is that Apple adds feature like stupid, but doesn't care about the bugs and the flaws. The performance having a lots of auto layout constraints is really bad (while design time), and the error-prone-ness has become huge. Example: even less complex Storyboards tend to get into a 'dirty mode' right after opening a project in Xcode (see git state). Tip: as a beginner you will love Storyboards since you can prototype quickly and get things running without lots of code. As you enter an intermediate state, you'll add more GUI code to your project. Now you start going back and forth between code and SB - and things start working out worse. Sooner or later you'll tend to do most of the GUI stuff in code, because the result is more predictable than having several sources.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With