📝 Setting up a UIKit-based project without Storyboards

I prefer to build my apps without storyboards, and when I start a new project I always forget how to remove them from a project. There are a couple of steps involved, and missing one can cause the app to crash, so I figured I’d jot it down here for future reference:

(Note: These instructions were developed with Xcode 12 beta)

1) Create your new project in Xcode:

2) Delete Main.storyboard! 💥

3) Remove storyboard references from the Info.plist:

4) Configure the setup of the initial view controller:

func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
    guard let windowScene = scene as? UIWindowScene else { return }
    let rootViewController = ViewController()
    window = UIWindow(windowScene: windowScene)
    window?.rootViewController = rootViewController
    window?.makeKeyAndVisible()
}

When you build and run the app, you’ll now be working with a Storyboardless interface.