Skip to content

Latest commit

 

History

History
73 lines (50 loc) · 1.74 KB

File metadata and controls

73 lines (50 loc) · 1.74 KB

How setup project with no storyboards

Xcode 13

AppDelegate

SceneDelegate

  • Delete Main.storyboard
  • Update Info.plist

  • Update SceneDelegate

SceneDelegate

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

Xcode 12

    var window: UIWindow?
    
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

        window = UIWindow(frame: UIScreen.main.bounds)
        window?.backgroundColor = .white
        window?.makeKeyAndVisible()
        window?.rootViewController = ViewController()

        return true
    }

Or with navigation controller

    var window: UIWindow?
    
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        window = UIWindow(frame: UIScreen.main.bounds)
        window?.backgroundColor = .white
        window?.makeKeyAndVisible()

        let navigatorController = UINavigationController(rootViewController: ViewController())
        window?.rootViewController = navigatorController

        return true
    }

Delete the storyboard from the project.

Delete Main storyboard file base name entry from Info.plist.