Why I Switched To Code From Storyboard

Shree Bhagwat
Codeaamy
Published in
4 min readApr 17, 2020
An image showing pictures of storyboard and ViewController
Storyboard To Code Transition.

So there has been a lot of debate on internet as well as in programmers about using Storyboard to design UI or designing the view Programmatically. Well if you look at the Storyboard Interface Builder you will be impressed. As we can clearly see Apple has put lot of efforts into developing the storyboard’s UI for us. Its quite handy.

I had my fair share of using both options for creating UI. So ill start with stating the pro parts of both the option.

Storyboard

User Friendly : Storyboard is very easy to use and very user friendly for developers. First time I started iOS app development and used Storyboard it was so much fun and easy. Way to impressive than Android Studio Layout Editor. It was so easy to navigate around, integrate objects into screen. All I had to do was just drag drop item into the design. I could change the colour, the font, the text, the title etc. So all I had to do was some clicks and some drag and drop and the result is achieved. The same would take lines of code to achieve programmatically.

See what you Edit : This is kind one of the most important aspect why people choose Storyboard. It gives us a visual representation of what we are editing and how it will come out to be. You can figure exactly where the button is going or where the text must go, what the colour should be etc. You can add constraints adjust the size of the objects. Their placements, everything.

Multiple Screen : In Storyboard we can create multiple views that are required in our app and navigate through these views with transition animation.

Programmatically

Control : When we use code to build the UI, we get complete control over the UI design. What ever we can achieve using Storyboard can be achieved over coding, even better. You completely understand how the UI works.

Changes : When we use storyboard and have to do changes into different views or multiple places, it takes a lot of work as you have to do all the changes one by one. But when we design UI programmatically, change on some lines of code and you achieved the changes. You can even keep all the UI elements at one place and can change the UI with the simple code change. Its easy to change the UI by code than by storyboard as me usually tend to forget to edit storyboard or miss out some elements.

Reusability : We agree that it takes a lot of time to create UI from code. But once the element is ready we can reuse the code to create the same UI again. We can just copy paste the code and re create the UI element. And when we see the design of an app, mostly the design of the element is kept constant. Hence we can reuse the code.

Clutter : So story board is all fine and good at the start. But when our app grows and our views increases, our storyboard gets clutterd. And we find lot of views with their segues used for navigation. It makes hard to find our view where we want to do the changes.

Cluttered Storyboard of FactsFever iOS app

Here you can see, when the views increase the clutterness starts to increase.

Multiple Developers : When our development is just done by one person we can use what ever option we like to build our app. But when multiple users come into development we have to look for some of the factors. We should make sure the technology we are using is compatible with all our developers. And most important, merging the code.

When we code the UI programmatically its easy for us to merge the code over github with and everyone can use the changed code. But when we use storyboard it gets hard for other developers to implement the UI design changes into our projects.

So with the over all pros of programming, I finally decided to switch to create UI programmatically and it actually helped me in many ways.

Each of the options have their own pros and cons and its hard for us to decide. So what ever suits the best of the situation, we will use that the most.

Please share your views, and also let me know what option would you use to design the UI.

--

--