UISplitViewController will not correctly collapse at launch on iPad iOS 13 : <p>I am transitioning my app to iOS 13, and the UISplitViewController collapses onto the detail view, rather than the master at launch — only on iPad.  Also, the back button is not shown - as if it is the root view controller.</p>

<p>My app consists of a <code>UISplitViewController</code> which has been subclassed, conforming to <code>UISplitViewControllerDelegate</code>.  The split view contains two children — both <code>UINavigationControllers</code>, and is embedded in a <code>UITabBarController</code> (subclassed <code>TabViewController</code>)</p>

<p>In the split view <code>viewDidLoad</code>, the delegate is set to <code>self</code> and <code>preferredDisplayMode</code> is set to <code>.allVisible</code>.  </p>

<p>For some reason, the method <code>splitViewController(_:collapseSecondary:onto:)</code> not being called.</p>

<p>In <strong>iOS 12</strong> on <strong>iPhone</strong> and <strong>iPad</strong>, the method <code>splitViewController(_:collapseSecondary:onto:)</code> is correctly called at launch, in between <code>application(didFinishLaunchingWithOptions)</code> and <code>applicationDidBecomeActive</code>.</p>

<p>In <strong>iOS 13</strong> on <strong>iPhone</strong>, the method <code>splitViewController(_:collapseSecondary:onto:)</code> is correctly called at launch, in between <code>scene(willConnectTo session:)</code> and <code>sceneWillEnterForeground</code>.</p>

<p>In <strong>iOS 13</strong> on <strong>iPad</strong>, however, if the window has compact width at launch e.g. new scene created as a split view, the <code>splitViewController(_:collapseSecondary:onto:)</code> method is not called at all.  Only when expanding the window to regular width, and then shrinking is the method called.</p>

<pre class="lang-swift prettyprint-override"><code>class SplitViewController: UISplitViewController, UISplitViewControllerDelegate {
override func viewDidLoad() {
        super.viewDidLoad()
        self.delegate = self
        preferredDisplayMode = .allVisible
}

func splitViewController(_ splitViewController: UISplitViewController, collapseSecondary secondaryViewController:UIViewController, onto primaryViewController:UIViewController) -&gt; Bool {
        print("Split view controller function")
        guard let secondaryAsNavController = secondaryViewController as? UINavigationController else { return false }
        guard let topAsDetailController = secondaryAsNavController.topViewController as? DetailViewController else { return false }
        if topAsDetailController.passedEntry == nil {
            return true
        }
        return false
    }
}
</code></pre>

<pre><code>class SceneDelegate: UIResponder, UIWindowSceneDelegate {
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {

        // Setup split controller
        let tabViewController = self.window!.rootViewController as! TabViewController
        let splitViewController = tabViewController.viewControllers![0] as! SplitViewController
        let navigationController = splitViewController.viewControllers[splitViewController.viewControllers.count-1] as! UINavigationController
        navigationController.topViewController!.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem
        navigationController.topViewController!.navigationItem.leftBarButtonItem?.tintColor = UIColor(named: "Theme Colour")

        splitViewController.preferredDisplayMode = .allVisible

}
</code></pre>

<pre><code>class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -&gt; Bool {
        if #available(iOS 13.0, *) {
        } else {
            let tabViewController = self.window!.rootViewController as! TabViewController
            let splitViewController = tabViewController.viewControllers![0] as! SplitViewController
            let navigationController = splitViewController.viewControllers[splitViewController.viewControllers.count-1] as! UINavigationController
            navigationController.topViewController!.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem
            navigationController.topViewController!.navigationItem.leftBarButtonItem?.tintColor = UIColor(named: "Theme Colour")

            splitViewController.preferredDisplayMode = .allVisible
        }

        return true
    }
</code></pre>

<p>It stumps me why the method is being called in iPhone, but not in iPad!  I am a new developer and this is my first post, so apologies if my code doesn't give enough detail or is not correctly formatted!</p>
