Hi,
just a cross reference to my answer on this thread.
tl;dr: I could solve it by moving the view modifier from the WindowGroup to the ContentView. I have not tested it for the .environment view modifier.
Non crashing example:
import SwiftData
import SwiftUI
@main
struct ExampleApp: App {
var body: some Scene {
WindowGroup {
ContentView()
.modelContainer(for: [Item.self])
}
}
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: