11

I am new to iOS development (No apps created yet), but I ask for advice from my friend that has really high rated apps on the market. He said not to use storyboards.

As much as I want to take his advice, they seem really helpful.

  • Is this something that can cause problems for my app in the future?
  • Is there any reason I may want to not use storyboards?

Coming from an Android background, I don't see why I should use them.

Banghua Zhao
  • 1,518
  • 1
  • 14
  • 23
EGHDK
  • 17,818
  • 45
  • 129
  • 204
  • 1
    I think you should be asking "WHEN should I use storyboards?" and not "IF I should use storyboards?". – Anton Dec 15 '12 at 03:35
  • Yes, I have seen that question, but didn't think it helped. Now that @Anton brings it up. I may have just been asking the wrong question. I guess I'll see how this question plays out. ALSO, could have been that I didn't understand the other question because I don't know what XIB is. – EGHDK Dec 15 '12 at 03:53
  • it depend on you at all, whichever you prefer better. – holex Jun 12 '13 at 22:46

6 Answers6

8

I'd recommend against using either storyboards or Interface Builder.

  • You'll learn Objective-C faster if you spend more time using it. Switching between IB and code, you'll have two things to learn. The context switching will still slow you down later on.
  • Nibs and storyboards are big XML files that don't play well with source control; if you're working on one at the same time as someone else, you will get merge conflicts.
  • You can't see everything that's going on at once in IB, so it's hard to track down things like layout problems.
  • You can't search or replace in IB the way you can in code
  • Nibs and storyboards put your view logic in your controllers. Whether that's a problem for you depends on how much of an MVC purist you are.
  • If you want to port your apps to/from Android, IB will make it much harder.

This all comes from experience. I started out running a small software team developing iOS apps using IB (storyboard wasn't out yet) and within a year it had caused so many problems that I'd had to forbid its use. Our productivity went way up when we stopped using it.

Simon
  • 25,468
  • 44
  • 152
  • 266
  • 2
    Point 1 - use tabs in Xcode to keep tasks separated, one tab for code, one for the storyboard. Point 2 - no longer relevant as of Xcode 5, yes they were a bit of a pain but this has been fixed. Point 3 - not sure what this is referring to. I have no problem seeing things, especially when they are visually drawn on the screen. Definitely a lot easier than interpreting code. Point 4 - yes you can, they are XML files, you can search and replace easily, but with refactoring you don't need to. Point 5 - no they don't. Point 6 - I'm writing iOS apps not Android. – Fogmeister Sep 19 '13 at 15:25
  • 3
    If anything Point 5 is exactly opposite to what you said. IB takes all your view and puts it in to one place... the view. By doing everything in code you are putting additional code into you controller just to set up the view. These all seem like the opinions of someone who didn't like the fact that there was a change and never went back. Yes Interface Builder was a pain to begin with but has since improved massively. I use it in all my apps. – Fogmeister Sep 19 '13 at 15:31
  • 4
    This is bad advice. In industry, people are definitely using interface builder. I think storyboards are more up in there at the moment. If you don't learn these skills you will mot be able to work as a modern iOS developer. – Matt Sep 25 '13 at 16:39
  • Point 6: You shouldn't be copying the exact layout for different platforms anyways. – elimirks Dec 09 '13 at 16:12
8

I tend to avoid storyboards for anything apart from perhaps a quick prototype. If you know you have a very simple app which isn't going to get complicated, and you're the only developer, storyboards might be ok.

Here are a few blog posts that detail some of the pain points when using storyboards:

Both of the above are a bit dated, but I believe the pertinent points still hold true.

Note that in theory you need to use a storyboard(s) to get static tables, which can be useful. To get this benefit, you could put only the static tables in storyboard files (note: you can have multiple storyboard files in an app) and use xibs or just code for the rest of the UI.

occulus
  • 16,959
  • 6
  • 53
  • 76
4

I think it's not important to use it or not,the most important is how your application is?(quality, beautiful, fast...). StoryBoard is great for beginner to shorten design time and understand. But when to become professional developer, you will love to draw your interface by coding because typing more faster than graphic.

LE SANG
  • 10,955
  • 7
  • 59
  • 78
  • 2
    I agree that storyboards can be a great introduction for a beginner but I do not think that "professionals" prefer to set up their interfaces by code, nor is it always faster than the graphical approach. For iOS 5+ apps, storyboards can make designing the interfaces and flow of an application considerably easier, depending on the needs of the app. – Anton Dec 15 '12 at 03:46
4

I don't think this question is really answerable. There are pros and cons of any technical decision and this one is no different.

Pros:

  • Visual, so you get a much better idea of what your app will look like more quickly
  • Less code
  • Autolayout can be easier
  • It's not all-or-nothing. You can build the "base" in Storyboards and finish it off in code

Cons:

  • A big hairball of an XML file makes merge conflicts pretty nasty
  • Less flexibility than code (no inheritance, etc.)
  • If you have lots of screens in your app, using a single storyboard can get pretty difficult unless you have a vast screen!
Stephen Darlington
  • 51,577
  • 12
  • 107
  • 152
3

It depends only on you. If you developing your application alone, storyboards are very useful. If you work in a team, it's better yo use .xibs because there is less problems with merging them with svn in comparison to storyboards

2

Very broad question. There are times when storyboards are great and other times when they are a hassle. Depends on the requirements and compatibility needs of your app.

See this answer for a great explanation of when to use storyboards and when to use XIBs:

When to use Storyboard and when to use XIBs

Community
  • 1
  • 1
Anton
  • 3,998
  • 25
  • 40