iOS Storyboards Should I use them or not? [duplicate] - ios

This question already has answers here:
When to use Storyboard and when to use XIBs
(9 answers)
Closed 9 years ago.
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.

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:
http://toxicsoftware.com/uistoryboard-issues.html
http://blog.waynehartman.com/archive/2012/01/07/uistoryboard-on-ios-5-the-good-the-bad-and-the.aspx
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.

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.

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.

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!

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

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

Related

Problems going from Storyboard to XIB?

I started a project using the Storyboard in Xcode 6 and now I think I would like to use XIB files. Are there any risks associated with moving from Storyboard to XIB? I thought I read somewhere that Xcode 6 would prefer developers to use the Storyboard, is this true? Are there benefits of using the Storyboard over XIB files? I feel like you have more control when using XIB files. Is there something I'm missing? Am I able to convert fairly easily or would it make more sense to start my project over?
I'm an Android developer moving into iOS, so please forgive my lack of knowledge on the subject.
UPDATE
I am more interested in knowing if there are any risks or problems in switching from Storyboard to XIB mid project. Currently, I'm using Storyboard, but I am thinking of switching some parts to XIB. Will this cause any problems with my project? Is there anything I need to be aware of in doing this?
Code, storyboard and xibs are all different ways of creating views and layouts.
There is no rule that says you can only use one of them in a project.
In most of my projects I use a combination of all three.
Storyboards give a quick and easy way to create "flow" in the app. I tend to use one storyboard per "workflow" inside the app.
Xibs I tend to use for views that are common in multiple places within the app. In a storyboard I'd have to define them multiple times. Using xibs is a bit like refactoring interface builder files.
I then fall back to using code when necessary. Sometimes it isn't possible to do what I want with interface builder.
To say that you are only going to use xibs is purely denying yourself access to the other tools. Learn when to use each and how to use them together.
There are some things like container views and embed segues that only work with Storyboards.
For the most part, though, it's a question of personal taste.
Apple does seem to be moving in the direction of Storyboards, so as a new developer you may want to put your efforts into Storyboards.
There are a lot of articles on the internet that discuss this topic, example: http://www.toptal.com/ios/ios-user-interfaces-storyboards-vs-nibs-vs-custom-code
I would take a look at the answers to this question for some great info.
Here's a quick summary:
Storyboards have some great features such as letting you create segues between views, and design table view cells in-place.
The biggest downside to storyboards is working a project with multiple developers. Dealing with merge conflicts can be a big headache.

iOS - UI design in coding and not in XIB or Storyboard is Feasible or not?

My doubt is very simple.
I want to develop one big iOS (iPhone) app of say 30 screens.
One my friend advice me to develop whole UI in coding only and do not use XIB's or storyboard.
I want to ask that, is it feasible for me to develop whole UI in coding instead using XIB and story board?
Will that affect my iOS app processing?
Will that affect my iOS app execution speed or not?
Please suggest me the proper way weather I use XIB and Storyboard of develop UI by Coding only ..... !!!!
Thank you.
Firstly, tell your friend not to give you advices again.(Just kidding! :)) You can develop the whole app programmatically but it's just a pain in the gut. Apple introduced the storyboards to ease the waste of having multiple xib files in your product.
For my personal opinion, use xibs in case of having lots of teammates working with you because of the pain of conflicts. If you're working solo, then storyboards would be the best fit.
Yes, there is no silver bullet that will solve all of your problems, every project is specific and your ability on predicting project requirements will enable you to decide. Here are some pros and cons of both approaches to help in making a decisions:
Storyboards/XIB pros: Very visual, Beginner friendly, Easy autolayout, MVC separation is straightforward on view side
Storyboards/XIB cons: SCM conflict are almost always unresolvable, not all parameters are configurable from IB so you still need to know how to do some stuff in code
Pure Code approach pros: Full control over entire presentation in code, conflicts resolvable easy as it can get
Pure Code approach cons: Might need more experience to master
My judgment would be:
Using storyboards/XIB is better solution for small to medium projects that consist of basic/stock UI elements.
Introducing visually complex solutions and non standard transitions will require that you start writing layout code more and more and stuff becomes easier without XIBs in your way.
From my experience if you are part of the bigger dev team, Storyboards and XIBs are a big NO..
I prefer not using IB at all even for smaller projects as pressing CMD+R after writing bunch of code, and seeing it come alive is very pleasing.. :-)
To answer your question literally: yes, you can make an app without any storyboards or xibs. I think with iPhone 6/6+ you have to have at least one because they check it to see if you support the bigger screens, but that's it.
In fact, my first app in 2013 had almost no Xib UI design. It was iPhone portrait only, I coded with frames and was happy with the precise results I got-- I also think I learned a lot. I think with Auto Layout, especially if you learned Visual Format Language (albeit that's not a easy thing to do) creating a robust interface entirely in code is doable.
That said, not using interface builder is not doing things "the Apple way." And not doing things the Apple way is usually -- not always, but usually -- going to be more difficult. On one level, WWDC videos, guides and sample code all assume you are using IB. Creating every label, subview and view controller in code is going to take several more lines, each, than using xibs or storyboard. You will be swimming against the current.
It's worth noting IB can be immensely frustrating at times. But generally it's worth it, and you learning how to relate it to the code is learning iOS programming. Also about IB , the files it generates are just XML files, it won't have any significant effect on size or performance- I'd be wary of advice from someone who told you that.
An all-code app is doable and would be a challenging way to learn, but this is not advice I would give anyone or second.

Storyboards only for iOS apps

I was little surprised when I was reading Apple Documentation from this Link
Which tells that
A user interface file for an iOS app has the filename extension storyboard. A user interface file for a Mac app has the filename extension xib.
I have used xib's in most of my projects and I still do the same which sometimes makes me little comfortable. Does this statement tells whether we should use only Storyboards in future ? Please share your suggestions
I work with some guys that still are uncomfortable with xibs in the way you may be with storyboards. They like using what they are comfortable with, and they maintain older code bases.
I believe Apple has found that people develop cleaner apps more quickly with storyboards, and are pushing folks in that direction. I don't see the removal of xibs any time in the foreseeable future, any more than I see people restricted from completely being able to to programatically create the entire app. You still have the option of using storyboards or not, and if not, its certainly easy to use xib's.
I was really hesitant about the storyboards, so my latest new project I decided to just dive in 100% on storyboards, and I was stunned at how happy I am with them and with segues. The communication between storyboards, the prototype cells in UITableViews and the visual linking of the ViewControllers really helped me.

Speed of iOS development using Storyboards vs programatically?

As a beginning iOS developer, which approach allows for quicker more efficient development?
There is no right answer to this. For someone who's been developing with Xcode for 2-3 years, the old programmatic way is more efficient, and storyboards feel alien. This is the situation I am in personally. For someone who is just starting out with Xcode or iOS development today, Storyboards will probably make more sense and pose a shorter learning curve. I can get my work done quickly by avoiding storyboards, but that's because I am too set in my old ways. Do whatever "feels right" to you, and adapt as the IDE evolves.
Creating a basic layout using Storyboard Paradigm is faster then do it programmatic.
However the best way is to combine all three ways (nibs, storyboards, programmatic) depending on what you have to do.
Because basic layout with little or no customization does not sell.
I use storyboards just to create a skeleton diagram to show it to the clients and to check if the flow of the views feel right.
Storyboards in my opinion seem harder to customize later using code, because is harder to access the inner elements.
Nibs are nice to speed up development by creating dummy views to avoid time calculating everything in code.
Code for doing customization and animations using Quartz.
I would go for the third option: Nib files. In my honest opinion, I think I have more flexibility with them than with Storyboards. I do think as well than in a near future I will be using Storyboard, but not at the moment, for me it's not a mature "approach" yet. Although sometimes I have the need to create some UI components by code, if I would do everything by hand I would be doomed.
In terms of speed you are probably not going to have a massive time difference. I do suggest however that you start using nibs and move on to storyboards. I guarantee you will come across code that will use nibs and possible (if not probably) manual reference counting. A colleague of mine runs a iOS training course and still teaches nib's and manual reference counting, then moves on to StoryBoards and ARC. It might take a bit longer to learn, but it probably will save you time in the future. I suggest If you are considering doing quite a bit, or serious iOS dev that you do take this approach.

Advantages and disadvantages of using Storyboarding? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I've been writing iOS apps for a while now and gradually went from doing the UI entirely programmatically to using the Interface Builder intensively. I'm now thinking about using the new Storyboarding feature for some of my new projects, but I don't have enough experience or knowledge with it to calculate the advantages and disadvantages of doing so.
Can anybody give some examples or information about when using Storyboarding payed off and when it was a waste of time?
Advantages of Storyboarding
It's cool - suave way to design interfaces
Use of StoryBoardSegues to identify navigation/modal relationships
If your app supports multiple devices, good way to organize different views (by storyboard file rather than naming, etc)
Nice for prototyping
Prototype UITableViewCell can save time
Disadvantages of Storyboarding
It's a runtime feature, so I believe it is only available in iOS 5
StoryBoardSegues are kind of rigid in my experience and you may make use of prepareForSegue a lot
Like IB, not very friendly with other display engines and toolkits
Makes it hard to share designs for a single view or set of views - you have to send all or nothing
These seem kind of superficial, I guess I haven't given it much thought... At first I was gung-ho about story boards, but now I've reverted to IB or even just programatic view configuration... The more I use them, the less I like them, and the more they feel like a gimmick/waste of time.
Edit
I wrote this answer a few years ago. I have left it the same as before for posterity, although some points are likely no longer relevant (ie the fact that it requires iOS 5+).
After some time, my opinion hasn't changed on storyboards. As others have mentioned, they're okay if you are working solo on an app with few views to manage, but they become a real pain with source control & collaboration. In addition, I prefer one-file-one-object, and storyboards obviously bundle stuff together (as does IB, but to a lesser extent).
If I were writing an app meant to be maintained for any serious length of time, I would go with programmatic view configuration over IB, but definitely IB over storyboards.
Another disadvantage with Storyboarding not mentioned is that merges can be very difficult if not impossible if there are conflicts.
Update: It also occurred to me that it puts logic in two places. If your segue is not doing the right thing it might be because of an error in prepareForSegue or it might be because you named your segue incorrectly. Doing things programmatically is, in the end, not that hard.
At the latest WWDC (2013) Apple Devs strongly recommend using storyboard and built in IB stuff to do most of your code for you instead of writing it by hand because you are much more likely to avoid deprecation and take advantage of feature updates via automated conversions.
The lone disadvantage is the difficulty in allowing git collaboration on storyboards, as there will be conflicts on virtually every commit.
If you are a solo programmer, you should always be using storyboards.
I have a similar background to you - I started with mostly building my iOS UI programmatically since IB was not really user-friendly, but lately decided to use IB more and more, since it is better for designing the UI and works fine for standard-elements.
With the new Xcode I switched to Storyboard, since they provide a full view of the application. It is possible to generate the complete UI (with all views) in a single File, which can be used for prototyping and which I can view my colleagues before writing the first code line. It is far better and easier than designing with photoshop or similar tools.
However if you use a lot of your own UI elements/controls or something using a different "engine" (cocos2d, OpenGL, etc.) it is usually better to generate the UI programmatically, since these "engines" are not really integrated with IB/Storyboards.
I have learn the storyboarding by following the tutorials from the raywenderlich's website and there is a lot of stuff about the storyboard.
Here is the link to site: http://www.raywenderlich.com/5138/beginning-storyboards-in-ios-5-part-1
Advantages of storyboard:
1) Before you start developing app you can see all the screens of the app.
2) You can visually see the relationship between each screen.
3) It can help to reduce the amount of the code specially in case of UITableView you can use prototype cells and static cells to design your TableView in storyboard.
4) In case if you have to work on someone else code you can get the better understanding of the flow of the app by viewing storyboard in short time.
5) You can setup the user interface for iPhone 4 and iPhone 5 by applying the retina form factor from storyboard, without running the app again and again.
6) If you are doing client based work then some clients want to see the prototype of the app before start developing it, here storyboard helps you a lot.
Disadvantages of storyboard:
1) For storyboard you will need a big screen specially in case of iPad.
2) I also experience a difficulty while copying views from other apps to storyboard.
3) I also experience problems in storyboard when multiple developers work on the same project by using git repository.
By reading and understanding the advantages and disadvantages you can judge your self when to use storyboard.
One Word (DON'T)
One of the biggest disadvantages of storyboard aside from the git conflicts that make it impossible for two or more persons to work on it. but also if the project went so big and you have +40 screens , if you insane enough to move anything just one pixel in any view controller you have in the storyboard, you'll have a very huge compilation time, that you can build your app and make it run in more than 5 minutes, and of course don't let me start with archiving to give some one adhoc of the app .
after this painful experience I totally fell back to the oldy goldy great xib files and deleted the storyboard file in a huge fire celeberation .

Resources