Create a iOS app without Storyboard, since Xcode 11.0 (iOS 13+)
Well, sometimes developers have a great opportunity to create projects from scratch. And after creating a project, developers are divided into 2 groups:
- Who preferer keep
storyboardas an entry point to the application.
- Who preferer set
Consider in more detail way set
rootViewController via code.
Before iOS 13 and Xcode 11
Before iOS 13 and Xcode 11 code for set
rootViewController we inserted in function
application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool in
After creating new Single View App project since Xcode 11, this way does not work.
Since iOS 13 and Xcode 11
So, way for set
rootViewController via code after Xcode 11 and iOS 13 changed.
There are some fundamental changes to the application lifecycle with iPadOS and iOS 13. Windows are managed by a
UISceneSession now. New projects have new Swift file
Also see sample app supporting multiple windows on iPad.
But this article answer another question: Where to setup rootViewController?
SceneDelegate has function
scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions). The function tells the delegate about the addition of a scene to the app. This is the right place to setup!
LoginViewController as root in
Thanks for reading! See you soon.