Everywhere I look on the net it says this will tell if the device is in darkmode or not
print(UITraitCollection.current.userInterfaceStyle == .dark)
Hoever, it returns FALSE no matter what… on Simulator and a real device
Everywhere I look on the net it says this will tell if the device is in darkmode or not
print(UITraitCollection.current.userInterfaceStyle == .dark)
Hoever, it returns FALSE no matter what… on Simulator and a real device
turns out this was in the Plist
<key>UIUserInterfaceStyle</key>
<string>Light</string>
import SwiftUI
struct ContentView: View {
@Environment(\.colorScheme) var colorScheme
var body: some View {
Text(colorScheme == .dark ? "In dark mode" : "In light mode")
}
}
Thank. but that is SwiftUI not Swift… incompatible syntax
the issue was what I stated above… thanks