Main application window programmatically in Xcode 11

Pavel Gnatyuk
2 min readJul 6, 2019

--

Photo by Zan Ilic on Unsplash

Very common beginning: create a new Single View App project in Xcode 11.

First look: everything is as usual. Deployment target is iOS 13.

I always remove Main.storyboard from my projects — search for “Main.storyboard” in the project. The location of the line in the info.plist changed, but it is there and it is removed.

Next step is to create a root view controller for my app. Where is a window variable in my application delegate?

There is no such property in application delegate. It’s moved to a new file, new class Scene Delegate.

UIWindow instance was the initial GUI object in the iOS apps till iOS 13. Now, starting iOS 13, new class UIScene (or UIWindowScene) appears first. And the UIWindow objects is added to this scene. In a special method willConnectTo of the delegate of the UIScene the UIWindow object and its root view controller are created.

This part of the scene delegate can be modified — use the window scene:

From this point I can begin…

--

--

Responses (2)