iOS Detect DarkMode

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

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