6 December, 2021

iOS developer’s View On Storyboards and NIBs

Creating a fluidic user-interface is one of the biggest challenges faced by mobile app developers irrespective of the operating system which they work on and iOS is no exception to it.

Considering iOS, developers have three options to juggle between which are NIBs, Storyboards and coding. Each of these three user interface building blocks has supporters and haters in equal numbers.

While the coding option is for those who love to do things in the hardcore way, Storyboards and NIBs are preferred by those who welcome simplifications and automations. However the discussion on which method is the best depends on the various factors like size and type of the project and the programmer who is working on it.

So, to skim off the doubts and make a few things clear on the highlights and drawbacks of these UI building methods, we decided to hear it from R.Vijayakumar an experienced iOS app developer at Contus. Here are the highlights of the questions raised to him.

What according to you are Storyboards and NIBs in short?

Storyboard:

Storyboard is an improvement on the NIBs concept and is the latest addition to the iOS UI toolkit. Storyboards helps you visually see the flow of your application, how the contents are represented in each layout (screens) and the transitions between them. It also helps you to manage the way controllers like View Controllers, Nav Controllers, TabBar Controllers etc communicate and respond to each other.

NIBs:

NIB files are those which represent a single view element and can be placed in the interface builder to get a visual of what it will look like. This helps you to create the user interface graphically.

What is “coding”? Why is it main feature of development apart from Storyboard and Nib?

Coding is the old school way of creating user interface in which all the graphical representations, positioning of elements etc are done by handwritten code. Though coding is considered time taking and studious by few of the new-generation developers this method has its own share of advantages.

First of all, coding provides you a free hand and a great control over the UI you are working on by reducing the dependency on some pre-defined tools which often hides the hardcore coding involved in it.

Developing UI programmatically will improve the performance of an app and while debugging, a developer can look for errors in the codes instead of checking it out with the interface builder. Merging codes can be done with much of ease and in a better pace.

How efficient or advantageous is using NIBs in UI development?

NIBs concept is the first ever methodology rolled out by Apple to visually design user interface in iOS. Well, with the Storyboards emerging as evolutionary improvement on NIB files, the latter is still preferred by a lot more due to the following reasons.

NIB files can be used to design any view and can be easily merged into the view controller wherever needed. NIB files represent the visual objects of your application and are packed along with controllers like View Controllers, Nav Controllers, TabBar Controllers etc. A view can be broke down into separate modules with NIB files of their own or even multiple modules (related) can be grouped in to a same NIB file.

Pros:

Re-usability:

  • User-interface components which are repeatedly used in various parts of design can be stored as a separate NIB file and can be re-used whenever needed.
  • It becomes much easier to develop, test and debug individual components
  • Easy to spot misalignment’s and make minute adjustments
  • Has less merging conflicts compared to Storyboards 

Flexibility:

  • Each individual component can be independently developed and can be placed on the Interface builder to make it to a visual tool.
  • However, using NIBs files UI can be shaped up
  • Shaping up a UI using NIBs files single-handedly
  • The UI can be shaped up using NIBs files single-handedly, but in a team environment, when two or more developers work on a project, it will be hard to spot the connections between classes. In case of storyboards, complete flowchart of the UI is readily available and hence these miscommunications don’t arise.

Can NIB and Storyboard be added into a single project?

The Xcode development tool allows the integration of NIBs and Storyboard and even coding into one single project, thanks to Apple Inc.,. NIB files can be used to overcome certain limitations of storyboards. For instance, in storyboards, adding UIView outside the View Controller is not possible and this  limitation can be overruled by using NIB files.

Storyboards handle the flow between the controllers and for the flow of data to be fluidic a developer will have to switch on to the programming mode.

Preview shots of the Storyboards View Controller.

Storyboard

Storyboard-View Controller

How and from which part a beginner should start with?

A beginner should have basic knowledge of OOPS concepts and C baseline. Understanding these basic concepts is the baseline to develop user interface for apps on iOS platforms as it is on the OOPS concepts the whole flow works on.

Well, considering all these suggestions, it is still very confusing to pick out the clear winner. It is better to conclude that the usage of these tools is purely based on the context, which means the type, size and demands of the UI design. And with the freedom to make use of all three methods in one single project, it’s is a waste of resource to stick to just one concept and ditch the others.

You would also be interested to learn: How to get crash reports without Xcode and Analyze

An iOS obsessed techie who holds expertise in all iOS app development methodologies. He writes as well as loves to surf around the web on technologies that simplify the day-to-day human effort.

16 Comments

  1. Gopalakrishnan R Reply

    Hi Vijay,this is great! .According to Apple “Storyboards are the Future” there is no code generated when you use storyboards or nibs. The views are encoded and decoded at runtime. My opinion is that Nib & storyboard are easy to start, but update takes more time. Code takes more time to start, but update takes less ..

  2. Chan Reply

    First of all I would like to thank apple for introducing storyboards. This makes the work of beginners in Xcode so easy. But without working in NIB’s one should not directly learn storyboards. Basics are always must. When the developers switch from NIB’s to Storyboards the work will be easier & they will prefer Storyboards more & more. But to be a good developer NIB’s are the best. Storyboards are good for the beginners and not for the developers. Additionally NIB’s can be added in storyboards – Thanks for mentioning this point. This is why Apple is different from other products. Thanks for this article. Keep sharing much stuff’s.

    1. vijayakumar Post author Reply

      Thanks @Chan for your points. But “Storyboards are good for the beginners and not for the developers” I disagree here. You know well that how storyboard integrates with NIB’s and help developers in app development,as you could view the flow of the development with the use of it. Do you think that developers don’t want storyboards?

  3. Immanuel Reply

    XIB’s is good for developers but Storyboards are best for development and it has more specifications such as, In future Auto layout will get more share in UI. Editor’s pin are more flexible in storyboards and no need to write bunch of codes while using storyboards. Storyboard avoids more codes by checking or unchecking the options which given for each and every sub UI controls when compare to NIB’s.
    As well as no need to use of segues, ie., Segues are not mandatory in storyboards. It will show the flow but instead of using segues we can instantiate the storyboard from any view controller and we dismiss the present view controller and set any other view controller as parent view controller.

    XIB’s are used to customize the views in storyboard.

    Beginners are advice to learn with XIB’s but initiate the development always with Storyboard + ARC + Auto layout.

    Still old developers are thinking XIB’s are always good for development, But storyboards are best for development.

    1. vijayakumar Post author Reply

      Thanks @Immanuel, Good share of insights. Yes obvious the combination of Storyboard + ARC + Auto layout will be the new dimension in development. With ARC you get focused to memory management and the speed of the app is manageable.

  4. Immanuel Reply

    @VijayaKumar, Thanks for such a blog and please do post same in such a social sites as FB, Linkedin to make more developers to know the usage of advance entities getting use in Xcode.

  5. Hema Reply

    Hi Vijay ,
    Happy to see such a useful post from you ,which is very useful for upcoming learners and the developers who are still using old Concepts will know the use of storyboard .We are waiting to see more useful posts from u in future. My kind advice is to post a post on technologies like phone gap,titanium etc..

    1. vijayakumar Post author Reply

      @Hema

      Thanks Hema for your comment.That’s a great encouragement for me and I will pursue to write technical post as you have suggested. Keep an eye with this blog for more useful post.

  6. Mike Reply

    Excellent article. Keep writing such kind of information on your page. Im really impressed by your site. I’ll definitely digg it and individually suggest to my friends. I’m sure they’ll be benefited
    from this site.

  7. minecraft Reply

    Very quickly this web page will be famous amid all blogging visitors, due to it’s content on different mobile application development platforms, and this particular blog post will be an eye-opener for most nerd iOs developers across countries. Try posting more contents like this!!

  8. Samantha Reply

    Hello there, You have done a great job. I will definitely digg
    it and personally suggest to my friends. I am sure they’ll be benefited from this website.

  9. Raghu Reply

    Great article! Agree with all the points you’ve mentioned here. Personally, I find XIB files are way more comfortable than using Storyboards. XIBs always come handy when it comes to creating a complex UI design on a single view controller because of its free distribution of different UI components on a single view. Having said this, we always need to keep in mind that Apple decides/suggests that Storyboards are a powerful tool. So, taking advantages of both these can really make a great impact in our development part. Kudos to you Vijay!!

Leave a Reply

Your email address will not be published. Required fields are marked *