Reputation: 21005
I have my system set to Dark Mode, but the app is light mode only, which works fine, having the main content view
.preferredColorScheme(.light)
however the search suggestions doesn't respect that
var body: some Scene {
WindowGroup {
ContentView()
.preferredColorScheme(.light)
.toolbar {
ToolbarItemGroup(placement: .navigation) {
Button(action: {
}, label: {
Image(systemName: "chevron.left")
})
Button(action: {
}, label: {
Image(systemName: "chevron.right")
})
}
}
.searchable(text: $searchText, placement: .toolbar) {
Text("Font family A").searchCompletion("Hello")
Text("Font family B").searchCompletion("HelloX")
}
}
.windowToolbarStyle(.unified(showsTitle: false))
}
How to make the search suggestion follow the preferredColorScheme
Upvotes: 1
Views: 173
Reputation: 21005
NSApp.appearance = NSAppearance(named: .aqua)
did work
var body: some Scene {
WindowGroup {
ContentView()
.onAppear(perform: {
NSApp.appearance = NSAppearance(named: .aqua)
}
Upvotes: 2