Last active
December 26, 2019 06:31
-
-
Save KiranJasvanee/4f88c8dd1efb3cb5e1b08b900e9f9636 to your computer and use it in GitHub Desktop.
GettingStartedwith-SwiftUI-2
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
// Create the SwiftUI view that provides the window contents. | |
let contentView = ContentView() | |
// Use a UIHostingController as window root view controller. | |
if let windowScene = scene as? UIWindowScene { | |
// cast UIScene instance to UIWindowScene to assign that scene to UIWindow. | |
let window = UIWindow(windowScene: windowScene) | |
// Use UIHostingController to create a view controller for SwiftUI view contentView. | |
window.rootViewController = UIHostingController(rootView: contentView) | |
// assign UIWindow instance to your delegate's window object to make it display when app launch happens. | |
self.window = window | |
// at the end, make it visible. | |
window.makeKeyAndVisible() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment