The App Delegate Must Implement the Window Property If It Wants to Use a Main Storyboard File Swift

The app delegate must implement the window property if it wants to use a main storyboard file

You are creating your window as a local variable and then trying to access it as if it were a property by using self.window. Make it a property.

Swift Code in App Delegate to Load Storyboard Causes Crash

Your app delegate needs to start like such:

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

//...
}

Can you set the window in the app/scene delegate and still use storyboard?

Set your root view controller either from SceneDelegate or from App Delegate or from the Storyboard, you don't have to do it in all the places.

If you are just trying to initialize your ViewController from code you don't need any storyboard and the initializer you called ViewController() does not instantiate a view controller from the storyboard. to know how you can instantiate a view controller associated with a storyboard please refer to this link.

You can use any view controller as a root view controller it depends on you.

isInitialViewController sets that view controller as the root view controller of the window.

If you just want to use your ViewController as the root view controller which you already codded in the app delegate, now just delete the storyboard and its references from info.plist file then you are good to go.

Specify App Delegate for Storyboard in iOS

did you set mainWindow if you are not please set your window in your project



Related Topics



Leave a reply



Submit