There exists a property to make app running always in Dark mode -- UIUserInterfaceStyle

problem is.... it doesn't work on macOS.
I have tried to set
file changes inside of the file is correct:
<key>UIUserInterfaceStyle</key>
<string>Light</string>
But result is always is the same - It just doesn't work and app runs with system configuration of theme.
Xcode: Version 11.3.1 (11C504)
MacOS: 10.15.2 (19C57) Catalina
App is based on SwiftUI
If you are looking for the full on SwiftUI version:
import SwiftUI
@main
struct SwiftUI_Football_GridApp: App {
var body: some Scene {
WindowGroup {
ContentView()
.preferredColorScheme(.light)
}
}
}
The problem is that UIInterfaceStyle is a UIKit feature. It is for tvOS/iOS. It does nothing on MacOS. You are writing a MacOS app, not an iOS app. Thus your changes to the Info.plist naturally have no effect.
The way to opt out of light/dark mode on MacOS is completely different, and is documented here:
https://developer.apple.com/documentation/appkit/nsappearancecustomization/choosing_a_specific_appearance_for_your_macos_app
Basically you want to use the NSRequiresAquaSystemAppearance key (though it would be better just to adopt dark mode compatibility).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With