You sometimes need to have a programmatic layout when making iOS apps. But, if you have been playing around with the Xcode beta, you might notice that your old code to do that doesn't work. This code is used in the func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions)
in SceneDelegate.swift to initialize the programmatic layout. There is also a Storyboard name in the Info.plist you have to delete. Happy coding!
Last active
December 17, 2019 00:47
-
-
Save DrBeta/0cf5a41d6d0b77bda3d9b4a6de8cdf9b to your computer and use it in GitHub Desktop.
Programmatic layout in iOS 13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Stuff before here (not neccesary for this gist) | |
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { | |
guard let windowScene = scene as? UIWindowScene else { | |
fatalError("Could not cast scene to UIWindowScene.") | |
} | |
let window = UIWindow(windowScene: windowScene) | |
window.rootViewController = UIViewController() | |
self.window = window | |
window.makeKeyAndVisible() | |
} | |
//Stuff after here (not neccesary for this gist) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated!