how do I initialise both, the managedObjectContext and the .environmentObject in the scenedelegate root view ?
I tried all variations of this code - it didn't work:
let contentView = ContentView().environment(\.managedObjectContext, context)
// Use a UIHostingController as window root view controller.
if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)
window.rootViewController = UIHostingController(rootView: contentView.environmentObject(UserSettings()))
self.window = window
window.makeKeyAndVisible()
}
Thanks for your help!