I have created the iOS Project in Xcode 11.1. I need to remove scene delegate from the application.
Asked
Active
Viewed 4.1k times
6 Answers
136
You need to do the following steps:
- Remove Scene delegate methods from App Delegate and delete the Scene delegate file.
- You need to remove UIApplicationSceneManifest from Info.plist.
You also need to add var window:UIWindow?
if it is not present in AppDelegate

Manav
- 2,284
- 1
- 14
- 27
-
3With Objecitve C, we need to add a window property in AppDelegate – Stella May 28 '20 at 20:06
-
2Added the same. Thanks – Manav May 29 '20 at 17:31
-
9A guideline with pictures https://stackoverflow.com/a/60329391/4026902 – RY_ Zheng Jun 03 '20 at 08:12
-
1not working in my case, the `didFinishLaunchingWithOptions` is not called anymore – Ben Aug 04 '20 at 23:11
-
1Figured out the coordinator pattern wasnt working because of the SceneDelegate, works now thanks – Naishta Sep 27 '20 at 07:01
-
@Naishta If you are using coordinator patter and using window, please access it from scene delegate. You will have the window for different scenes there. – Manav Sep 28 '20 at 05:13
-
Removing `UISceneSession` lifecycle from `AppDelegate` is essential to get it working. – boro Nov 25 '21 at 16:47
46
- Remove
SceneDelegate.swift
file - Remove
Application Scene Manifest
fromInfo.plist
file - Add
var window: UIWindow?
to AppDelegate.swift - Replace
@main
with@UIApplicationMain
- Remove
UISceneSession Lifecycle
( functions ) inAppDelegate

Nguyễn Quang Tuấn
- 883
- 11
- 6
23
It is a complete solution for empty project generated with Xcode (with storyboard)
- Remove
SceneDelegate.swift
file - Remove
Application Scene Manifest
fromInfo.plist
file - 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
}
}

milczi
- 7,064
- 2
- 27
- 22
13
- Remove SceneDelegate.swift file
- Remove Application Scene Manifest from Info.plist file
- Remove UISceneSession Lifecycle function from your AppDelegate class
- Add
var window: UIWindow?
in your AppDelegate class as a instance property - Replace
@main
attribute with@UIApplicationMain
attribute (This saves as to manually create and assign window)
Below is how you how your AppDelegate should look like after changes:
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
}

Amit Samant
- 13,257
- 2
- 10
- 16
1
Just in case if you are developing in Objective-C
, add window
property in the AppDelegate.h
file like this:
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
No need to initialise the window
. It will work automatically.

HAK
- 2,023
- 19
- 26