Skip to content

Instantly share code, notes, and snippets.

@samkhawase
Last active September 24, 2020 06:15
Show Gist options
  • Save samkhawase/62e987726feb0ea71cee7eb210a8424f to your computer and use it in GitHub Desktop.
Save samkhawase/62e987726feb0ea71cee7eb210a8424f to your computer and use it in GitHub Desktop.
Method that acts as an entrypoint to our Scene based app
// Method that acts as an entrypoint to our Scene based app
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Create the SwiftUI view that provides the window contents.
let contentView = ContentView(viewModel: PhotoStreamViewModel())
// 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