How to check dark mode with color scheme in SwiftUI

Issue #692

Use colorScheme environment, for now it has 2 cases dark and light

1
2
3
4
5
6
7
struct MainView: View {
@Environment(\.colorScheme) var colorScheme

var body: some View {
Text(colorScheme == .dark ? "Dark Mode" : "Light Mode")
}
}

Comments