Created
July 3, 2019 08:37
-
-
Save el-hoshino/efa1afd73f154204c82875cae30daa28 to your computer and use it in GitHub Desktop.
Xcode 11.0 beta 3の画面SceneDelegate地味に変わってる👀beta 2まではwindow = UIWindow(frame:) だったけど、これからはwindow = UIWindow(windowScene:)に #CodePiece
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
// Xcode 11.0 beta 2 まで | |
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { | |
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. | |
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene. | |
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). | |
// Use a UIHostingController as window root view controller | |
let window = UIWindow(frame: UIScreen.main.bounds) | |
window.rootViewController = UIHostingController(rootView: ContentView(model: model)) | |
self.window = window | |
window.makeKeyAndVisible() | |
} | |
// Xcode 11.0 beta 3 から | |
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { | |
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. | |
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene. | |
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). | |
// Use a UIHostingController as window root view controller | |
if let windowScene = scene as? UIWindowScene { | |
let window = UIWindow(windowScene: windowScene) | |
window.rootViewController = UIHostingController(rootView: ContentView()) | |
self.window = window | |
window.makeKeyAndVisible() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment