5 Replies
      Latest reply: Jan 20, 2018 12:02 PM by SpaceMan RSS
      MattDouhan Level 1 Level 1 (0 points)

        Hi

         

        All the tutorials out there tells me I should get two seperate storyboards when I create a universal app, one iphone and one ipad

         

        But when I create my univeraal project I only get a single main storyboard

         

        Am I doing something wrong ?if so what?

         

        M

        • Re: Universal app in xcode 8 one or two storyboards
          eskimo Apple Staff Apple Staff (8,720 points)

          Having two storyboards might make sense, depending on your app, but a lot of apps these days are adaptive.  That is, they don’t have custom UIs for each type of device, but have one UI that adapts based on the size class.  A good introduction to this concept is WWDC 2016 Session 222 Making Apps Adaptive.

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"

          • Re: Universal app in xcode 8 one or two storyboards
            macrojd Level 1 Level 1 (0 points)

            Just in case someone's still looking for this, here is my solution. Replace the method in the AppDelegate class by the following:

             

            
                func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
                    /
                    var storyboard: UIStoryboard!
                    let device = UIDevice.current.userInterfaceIdiom
                    if device == .pad {
                        storyboard = UIStoryboard(name: "iPad", bundle: nil)
                    } else {
                        storyboard = UIStoryboard(name: "Main", bundle: nil)
                    }
                    window?.rootViewController = storyboard.instantiateInitialViewController()
                    window?.makeKeyAndVisible()
                   
                    return true
                }
            

             

            This code loads the iPad.storyboard file on iPads or the Main.storyboard file in any other device.

              • Re: Universal app in xcode 8 one or two storyboards
                SpaceMan Level 1 Level 1 (10 points)

                Back when the iPad was just coming out, Apple was pushing to make the app on an iPad a unique experience from the iPhone due to the greater real estate on the iPad.  But now, they want things to be more the same.  When I first adapted to the iPad, just before the iPad went on sale, I had completely different code and completely different .xib files.  I have a tabbar comtroller on the iPhone and a splitview controller on the iPad.  My app is old now and needs to be modernized.  I'd love to make it adaptive but the differences are too great, I think.