Skip to content

Instantly share code, notes, and snippets.

@fitomad
Created October 15, 2019 13:36
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 fitomad/ea1b06abcfcae0ccc22c125d2063c21c to your computer and use it in GitHub Desktop.
Save fitomad/ea1b06abcfcae0ccc22c125d2063c21c to your computer and use it in GitHub Desktop.
// Use a UIHostingController as window root view controller
if let windowScene = scene as? UIWindowScene
{
let window = UIWindow(windowScene: windowScene)
// Variable de entorno para `managedObjectContext`
// Es necesario para luego usar `@FetchRequest` en
// las vistas.
let sessionView = SessionsView()
.environment(\.managedObjectContext, DataManager.shared.managedObjectContext)
window.rootViewController = UIHostingController(rootView: sessionView)
self.window = window
window.makeKeyAndVisible()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment