I am trying to achieve reading dark mode in my app built in SwiftUI, Xcode 12 and iOS14.
I am using this key to find wether or not it's in light or dark mode: @Environment(\.colorScheme) var colorScheme
My testing device is set to dark mode, but the environment variable is reading light mode.
I have tested this removing the app, reloading XCode, and restarting my Macbook Pro.
User Interface Style
is not used since this is iOS14. (SwiftUI: Dark mode not detected when testing on device)
The weird thing is, my testing device (iPhone 11 Pro) renders non-background colored views as dark as they should. So the only thing that isn't updating is the variable colorScheme itself. I am not changing that value anywhere in my app programatically.
I also checked that my info.plist is routed properly in the build settings of the target. I am using a target for the main app, and a target for a widget extension.
What am I Missing?