Search code examples
swiftxcodeappdelegate

AppDelegate window initialisation does not have correct size


I have an app in Xcode which I want to start without a storyboard, so I created a new window in AppDelegate:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    
    let InitialViewController: SignViewController = SignViewController()
    let NavigationController: UINavigationController = UINavigationController(rootViewController: InitialViewController)
    
    self.window = UIWindow(frame: UIScreen.main.bounds)
    self.window!.rootViewController = NavigationController
    self.window!.makeKeyAndVisible()
    
    return true
    
}

The problem with this is that if I simulate it, it returns a weird looking screen which seems to be too small on the y-axis, and I don't know why:

enter image description here

What do I need to change?


Solution

  • Check your info.plist. If you deleted "Launch screen interface file base name", add it back.