How to remove Scene Delegate from iOS Application?

It is a complete solution for empty project generated with Xcode (with storyboard)

  1. Remove SceneDelegate.swift file
  2. Remove Application Scene Manifest from Info.plist file
  3. Paste this code to your AppDelegate.swift file

import UIKit

@main
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window:UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        self.window = UIWindow(frame: UIScreen.main.bounds)
        window?.rootViewController = UIStoryboard(name: "Main", bundle: nil).instantiateInitialViewController()
        window?.makeKeyAndVisible()

        return true
    }
}

To add to accepted answer: you also need to write this in your AppDelegate:

 self.window = UIWindow(frame: UIScreen.main.bounds)
 let controller = MyRootViewController()
 window?.rootViewController = controller
 window?.makeKeyAndVisible()

You need to do the following steps:

  1. Remove Scene delegate methods from App Delegate and delete the Scene delegate file.
  2. You need to remove UIApplicationSceneManifest from Info.plist.

You also need to add var window:UIWindow? if it is not present in AppDelegate


  1. Remove SceneDelegate.swift file
  2. Remove Application Scene Manifest from Info.plist file
  3. Add var window: UIWindow? to AppDelegate.swift
  4. Replace @main with @UIApplicationMain
  5. Remove UISceneSession Lifecycle ( functions ) in AppDelegate

Tags:

Ios

Swift