Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 11, Main Interface fixed with Main.storyboard [duplicate]

Main Interface is not changing with another storyboard in Xcode 11, it always run with Main.storyboard after changing with another storyboard, I have checked "is initial View Controller" after using a View Controller in new Storyboard.

I have tested in Xcode 10, it was working fine.

Did I miss something in Xcode 11?

enter image description here enter image description here enter image description here enter image description here In plist. enter image description here

like image 999
Abhishek Mitra Avatar asked Sep 24 '19 07:09

Abhishek Mitra


People also ask

Can you combine swift UI with storyboard?

The answer is YES! Here we will be discussing a simple way to use SwiftUI into our existing project, which already consists of a storyboard. Let's dive in then!

How do I change the main interface in Xcode?

In Xcode 14, there is an interface change. The "Main Interface" field is no longer shown in the "General" Tab. You need to go to the "Build Settings" tab and search for the "UIKit Main Storyboard File Base Name" key. Then remove the key or set the value to empty.

Can we use multiple storyboards in one application?

A storyboard is meant to explain a story, not a saga. An app's storyboard can be easily divided into multiple storyboards, with each one representing an individual story.

How do you duplicate on storyboard?

Click the More Icon (⋮) located at the right end of each shot strip, or in the top right corner of a Storyboard shot. Then click Duplicate Shot.


2 Answers

Swift 5 with iOS 13

One more changes require in info.plist file under Application Scene Manifest group.

enter image description here

Change name in Application Scene Manifest also.

Additional:
If you want to create the root window without a storyboard, you need removing the Main storyboard file base name and Storyboard Name item from Info.plist, and create the window programmatically in SceneDelegate:

class SceneDelegate: UIResponder, UIWindowSceneDelegate {

    var window: UIWindow?

    @available(iOS 13.0, *)
    func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
        // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
        // If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
        // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
        guard let windowScene = (scene as? UIWindowScene) else { return }
        window = UIWindow(windowScene: windowScene)
        // continue to create view controllers for window
    }

    //......
}
like image 153
Pratik Sodha Avatar answered Oct 22 '22 20:10

Pratik Sodha


Can you please change "Main storyboard file base name" to your storyboard file name.

like image 1
tys Avatar answered Oct 22 '22 19:10

tys