When creating a new iOS project in Xcode 12 a UISceneDelegate
is added automatically. Since my App should be available on iOS 11+ (which does not support UISceneDelegate
) I had to remove it.
Removing the UISceneDelegate
from info.plist
and from the AppDelegate
was no problem of course. However I wonder if I have to add any code to application(_: didFinishLaunchingWithOptions)
In most tutorial I found this method is simply left empty, only var window: UIWindow?
had to be added. Other sources show that some setup code has to be added.
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
/* Manual Setup */
// let window = UIWindow(frame: UIScreen.main.bounds)
// window.rootViewController = ViewController() // Your initial view controller.
// window.makeKeyAndVisible()
// self.window = window
return true
}
}
In my tests everything works fine without any additional setup code. The rootViewController is loaded automatically from Storyboard and everything works fine.
Is this just coincident, is this some Xcode magic happening in the background (adding rootVC automatically if code is missing), or is my code (without setup) broken and will eventually fail at some very bad moment