Building an iOS app without Storyboards

Andrew
I am Become Coder, Creator of Code Things
2 min readNov 10, 2020

Why should I?

Interface Builder is great whilst you’re learning on your own, but as your app and team grows, you’re likely to have regular fights with merge conflicts because of storyboards. They just don’t play well with version control.

How do I start?

Glad you asked.

  1. Start a new project (single view template is great). Once it’s ready, delete Main.storyboard from the Project navigator (Right-click -> Delete -> 👋🏼
  2. Next, click on your project’s Info.plist file and delete the two highlighted keys:
A list of key-value pairs

3. Now head on over to SceneDelegate.swift and make it like so:

// 1 Firstly, we build a new navigation controller to house our root view controller, which in this case is the standard one that Apple’s template gave us.

// 2 Then we build a new window using the scene object.

// 3 Then we set the app’s window to our newly-built one.

// 4 Then we assign the previously-built navigation controller as window’s root view controller.

// 5 Finally, we position the window on top of all others.

6. And then in ViewController.swift, like so:

Now, you’ll be in exactly the same place before we started, but without a pesky storyboard to get in the way, and the ability to take better advantage of dependency injection. Nice 🙌🏼

You may have noticed that my code snippets above are very lean. That’s how I code, as least clutter as possible. The first thing I do when I start a new projects is all of the above, as well as gutting Apple’s boilerplate & comments. Less is more, to me 🤘🏼

Written with Xcode 12.1 targeting iOS 14.1.

--

--

Andrew
I am Become Coder, Creator of Code Things

iOS Software Engineer. Punster extraordinaire. Part-time nerf herder.