This exact code appears in apple's comment in the SwiftUI module, but when I use it, it fails to compile with errors:
I tried @EnvironmentObject as well and it get different errors.
Enum 'Environment' cannot be used as an attribute
Type annotation missing in pattern
I tried @EnvironmentObject as well and it get different errors.
Code Block @main struct MyApp: App { @Environment(\.scenePhase) private var scenePhase var body: some Scene { ...