Why I Don’t Use Storyboard
I had enough of it
I wanted to share my biased conclusion that Storyboard has more cons than pros based on my limited experience working in a startup with 8 other developers.
Disclaimer: I use storyboards all the time. I have specific usage cases. I’m aware it isn’t a black and white answer. Only tradeoffs exist.
First, you will learn at which circumstances I favor storyboards. Second, you will learn at which circumstances I do not favor storyboard. Last, you will get a call-to-action message about my upcoming course. Let’s get started. ✍️
When I Prefer Storyboard
If you’ve been my reader, you’ve noticed all of my tutorials use storyboards. Here is why.
If I were to create two view controllers with a navigational controller attached and add a button that connects from the first view controller to the second with a segue, it should take about 30 seconds with a storyboard. However, if I were to do it programmatically, it just takes longer for the initial step: get rid of the storyboard, set up
UIWindow, set constraints, create objects, add the push method when the button is pressed. So, when I create a tutorial that shows specific features such as
UIAnimation, I prefer Storyboard.
When I create a tutorial, I use a storyboard just because it is visual and we love that kind of stuff. I don’t like creating static objects programmatically such as
UIImageView. It is just labor intensive and doesn’t require many brain cells.
When I teach, I don’t wanna make my audience fall asleep. So, why not make it a little more interesting since seeing is believing. 🤔
When a beginner without any programming experience asks me whether one should learn to code programmatically, I always suggest using a storyboard first, and then move on if he/she wishes to. A storyboard provides a great place for those who are not familiar with the iOS ecosystem such as how the navigation and tab UIs are structured. Also, it allows one to figure out how the default objects such as
UISlider look like and get used to the properties and methods associated.
Especially graphic designers would love Storyboard because it feels like a slow version of Sketch or Powerpoint. It just feels intuitive.
To sum up, I prefer using a storyboard when I give a presentation or introduce one to the iOS ecosystem.
When I Prefer Fingering
I may sound more aggressive because I fear projects with storyboards. 😅
For those who have not used Github before, it’s analogous to Dropbox for geeks.
If you and your partner were to work on the same storyboard file, and try to upload to the cloud, you will get massive lines of conflicts because Github doesn’t know whose code to prioritize. As a result, you must fix line-by-line before you may re-upload to the cloud. A storyboard consists of mere (a lot) lines of code that renders UI. For instance, if your partner has removed a button, and you try to change its color, you will face a bunch of inhumane merge conflicts that lead to ☠️
Some argue that you can create one storyboard for each view controller to prevent ☠️ since no developers should work on the same view controller. I mean, we don’t live in an ideal world. How tedious is it for developers to be like,
Bro, I’m gonna work on this. Don’t touch this until I say so. Actually… Please — Me
I love creating objects programmatically because all I have to do is copy and paste from previous projects for such UIs. For example, I refuse to design a login view controller if I’m joining a hackathon, and I only have 24 hours. Speed is everything for freelancers. I mean, you could still use a storyboard and create objects programmatically, but then what’s the point using a storyboard with empty view controllers? It just goes against what the name represents.
Story + Board
It’s more like an empty board.
I also fear segues. If you have more than 10 view controllers in a storyboard and each view controller is navigated through segues, it becomes ☠️ for you to update the flow or re-design.
I mentioned that the initialization step is faster using a storyboard. But what If I had a boilerplate where I could simply copy and paste even for the initial stage. It’s arguable which method is faster.
You’ve got to know all
If you no longer rely on storyboards, you are more likely to refer the API documentation often because you have to search for properties and methods. I mean there is no excuse. There is no
IBDesignable for you to change the border radius. So, the more you look through the doc and research, you start to get used to the ecosystem. For example, you get a detailed understanding of how
UINavigationBar work. It is essential because sometimes you might have to override their properties and methods through subclassing. If you’ve been only relying on storyboards, you will face a crisis.
No More Typing
In order to connect view controllers in a storyboard to swift files, you have to manually type strings on the storyboard for identifiers. It’s just annoying as f. Of course, when I get the spelling down, I can store it as a constant. But, if you were to add more view controllers or change its name, not only you have to change the name from its Swift file, but also from the storyboard. It’s hella time-consuming. It’s just a waste.
Some argue that Storyboard provides the exact flow of an app. But, to me, it just feels like an excuse because if anyone is serious about making apps or websites, you always start off with designs and interviews to prove its worth. You should know the exact number of view controllers, animation, and pixel-perfect mockups. That argument should be only used by a lazy ass.
What Leaders Prefer
YouTube, Facebook, Messenger, Instagram, do not use storyboards. I get it. some use React Native which renders UIs programmatically as well. So, If big players abandon it, I guess it’s okay to follow them because I aspire to follow their practices and learn from them.
To give you an analogy, in web development, more people are able to create websites through drag and drop, but there is no way for those to build ones like Medium, YouTube, and Facebook.
If you’ve never created apps programmatically, and you want to get started, feel free to download its source code here.
When you create a view programmatically, you use
loadView instead of
viewDidLoad. I’m not going to talk about it in this tutorial, and it is not reflected in the example.
I hope you understand by now why I don’t like using Storyboard if I were to create my personal projects. Of course, unlike the cover photo, there is a place for it.
Surprisingly, many courses and books, including mine, are written with Storyboards despite I don’t use them. So, I’ve decided to create a course called, The UIKit Fundamentals with Bob. If you want to know more about how to code programmatically with protocol oriented reusable table view, collection view, and design patterns along with Realm Database, Shoot me an email at firstname.lastname@example.org to be on the waiting list.