New in iOS 13, multi-windows app requires UIWindowSceneDelegate.

This post is an update to an earlier post for pre-iOS 13.

1. Remove UISceneStoryboardFile

Scenes are defined in your app Info.plist. There is a UISceneStoryboardFile key with default “Main” storyboard. Remove that key-value pair.

Your plist should look like this:

        <string>Default Configuration</string>

2. Remove UIMainStoryboardFile

Also in Info.plist, remove the storyboard key-value.

3. Setup SceneDelegate

Change the setup of the scene delegate to as such:

func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
    if let windowScene = scene as? UIWindowScene {
        let window = UIWindow(windowScene: windowScene)
        window.rootViewController = MyCustomViewController()
        self.window = window

The code creates your custom view controller programmatically, then setting it to the root of the window for the scene (phew)!




Back to Home