How would Swift look without a Storyboard?

Storyboards do a lot of things for IOS app developers behind the scenes some of which are obvious & some not so obvious, so this blog is an attempt to provide some insight into what goes on behind the scenes.
Whether we should use storyboard or just do everything in plain code is a debatable topic which deserves a blog of its own so i will not go into that here.
Below i will provide steps for creating & running an app without using a storyboard, using Apple’s Single View Application template as a starting point. Let’s name this app ByeByeStoryboard.
Step 1: Create a project

Step 2: Remove the storyboard & any reference to it

Next we need to make sure the app is no longer looking for the storyboard as we will handle the app’s startup. Open Info.plist and remove the entry with “Main storyboard file base name”.
It is a good idea to build & run often during the course of app development. So let’s build and run our app. You should see a black screen something like this:

Step 3: Define our app window
Now let us define our own window. In AppDelegate.swift we will write code for following :
- Create our own window and store it in the existing window property.
- Set its background color to brown.
- Set our initial view controller to ViewController. To do this we will set the rootViewController property of our window to ViewController instance.
- Finally we will call makeKeyAndVisible on the window. This makes our window visible and sets it to be the active window.

Now let us build & run our code to see how it looks. Here is what we get :

Hurray!!! We have built our first app without using a Storyboard.

