Skip to content

Instantly share code, notes, and snippets.

@WildStudio
Last active August 15, 2019 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WildStudio/547bffa9562b1e97eb93580a3b2bd3bb to your computer and use it in GitHub Desktop.
Save WildStudio/547bffa9562b1e97eb93580a3b2bd3bb to your computer and use it in GitHub Desktop.
SceneDelegate.swift snippet
// Instantiate a new UIWindow with the size of our phone screen and assign it to the window property
let window = UIWindow(frame: UIScreen.main.bounds)
// Instantiate a UIHostingController which is a ViewController but it is capable of holding the new SwiftUI View.
window.rootViewController = UIHostingController(rootView: ContentView())
self.window = window
// Make the window key and visible. This is telling it is the active window.
window.makeKeyAndVisible()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment