Why I Don’t Use Storyboard
I had enough of it
Motivation
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.
Objectives
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.
Quick Initialization
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 delegate
or UIAnimation
, I prefer Storyboard.
Visualization
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 UILabel
and 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.🤔
Lower Barrier
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 UISegmentedControl
and 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. 😅
Merge Conflict
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
Reusability
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 UITabBarController
and 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.