I’m trying to get the Use colorScheme environment value in the view and based on the colorScheme, use a different theme model for Colors
@Environment(.colorScheme) private var colorScheme
self.themeModel.setTheme(colorScheme == .light ? LightTheme() : DarkTheme())
But I get warning
Accessing Environment’s value outside of being installed on a View. This will always read the default value and will not update.
And always see colorScheme = .light
How can I do this?
1