Created
June 10, 2019 23:13
-
-
Save josephlord/52214d2d1f3f59b2ceccbcb293259d21 to your computer and use it in GitHub Desktop.
An appropriate willConnectTo method to set up for multi-scene usage. State restoration needs additional work
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
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 | |
guard let scene = scene as? UIWindowScene else { return assertionFailure() } | |
let window = UIWindow(windowScene: scene) | |
configure( | |
window: window, | |
activity: connectionOptions.userActivities.first ?? session.stateRestorationActivity) | |
self.window = window | |
window.makeKeyAndVisible() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment