skip to Main Content

I’ve just implemented SceneDelegate to my old iOS project which has two storyboards – iPhone.storyboard and iPad.storyboard.
There are both AppDelegate.swift and SceneDelegate.swift files without specific codes – just empty delegate methods.

info.plist file

The problem is that I have to change the storyboard name whenever I run with different device types – iPhone or iPad. My questions is how I can set multiple storyboard names to Application Scene Manifest section of info.plist file. It obviously runs with iPad.Storyboard file when I run with iPhone simulator for now.

P.S. I’ve already set Main storyboard file base name and Main storyboard file base name (iPad) values with iPhone and iPad.

2

Answers


  1. The only variant that I found for now is this where setting different storyboards are done in SceneDelegate. Not at the info.plist.

    Login or Signup to reply.
  2. I had this problem, what you need to do is add a new scene configuration in the info.plist. I used the default one to load a storyboard for iPhones, and added a new configuration to load my iPad storyboard.

    enter image description here

    Change ‘Enable Multiple Windows’ to ‘YES’

    Then in the AppDelegate.swift –

    func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
        // Called when a new scene session is being created.
        // Use this method to select a configuration to create the new scene with.
        
        var config = "Default Configuration"
        
        if IS_IPAD {
            print("IPAD - LOADING IPAD CONFIG - (config)")
            config = "ipad Configuration"
        }
        print("LOADING CONFIG - (config)")
        
        return UISceneConfiguration(name: config, sessionRole: connectingSceneSession.role)
    }
    

    This solved it for me, I hope this helps people.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search