Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove Scene Delegate from iOS Application?

Tags:

ios

swift

People also ask

What is scene delegate in IOS?

Advantages of SceneDelegate:- This is the result of new multi-window support feature that is introduced with iPad-OS. The UIScene API allows us to create multiple instances of our app's UI as separate instances in the application switcher.

How do you delete a storyboard?

Step 2: Delete the Storyboard Your new project has been created, now navigate to the left side of your interface, select the “Main. storyboard” file in the main folder, left-click and hit delete.


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


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()

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
    }
}