iOS without storyboard

Why?

Programmatically/Code or NIB based layouts are a much better fit for projects that use version control (see merge conflicts) and make it much easier to reuse views. If you are deciding not to use storyboards, you will need to manually set your application window to your desired UIWindow

Prerequisites:

– Delete Main Interface from Deployment Info Settings

– Delete the Main.storyboard file

How to: set up a iOS project without storyboard

Step 1: Create a UIWindow with the frame using the bounds of the UIScreen

UIWindow(frame: UIScreen.main.bounds)

Step 2: Assign this to the AppDelegate window property

window = ...

Step 3: Make the window “key” and “visible” 

window?.makeKeyAndVisible

Step 4: Set the window `rootViewController` to the VC of your choice

window?.rootViewController = ...

Code: link

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s