The programmatic ios app

My checklist when making a programmatic iOS app

  1. Clean up the AppDelegate class:
import UIKit
class AppDelegate: UIResponder, UIApplicationDelegate {
   var window: UIWindow?
   func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
      _ = window
      return true
  1. Delete Main storyboard file base name in the info.plist
  2. Now you can delete ViewController.swift
  3. Add MainVC and MainView
class MainVC :UIViewController{
	override func viewDidLoad() {
      view = MainView()
      view.backgroundColor = .orange
class MainView:UIView{}
  1. Add a Window and a ViewController to the AppDelegate.swift and ref _ = window:
lazy var window: UIWindow? = {
   let win = UIWindow(frame: UIScreen.main.bounds)
   let vc = MainVC()
   win.rootViewController = vc
   win.makeKeyAndVisible()/*Important since we have no Main storyboard anymore*/
   return win
  1. CMD + R Run the app, if the background is orange it works