GreatOm
1
Hi!
I want to use Option-Command-S for a "Save As…" menu but it does not work as expected. Other modifiers work well. (Xcode 14.3, macOS 13.5.2)
Here is the sample code:
import SwiftUI
struct ContentView: View {
var body: some View {
Text("Hello, world!")
}
}
@main
struct kbTestApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
.commands {
CommandGroup(replacing: CommandGroupPlacement.newItem) {
Button("None") { }
Button("Command") { }
.keyboardShortcut("s", modifiers: [.command])
Button("Option"){ }
.keyboardShortcut("s", modifiers: [.option])
Button("Shift Command"){ }
.keyboardShortcut("s", modifiers: [.shift, .command])
Button("Option Command"){ }
.keyboardShortcut("s", modifiers: [.option, .command])
Button("Shift Option Command"){ }
.keyboardShortcut("s", modifiers: [.shift, .option, .command])
}
}
}
}
The menu is:

Do I miss something here or is it a SwiftUI bug?
PS: Using Xcode 15 beta 8 makes no difference.
jrose
(Jordan Rose)
2
Is it S specifically? In that case, maybe you have a global shortcut bound to Cmd-Opt-S in System Preferences Settings, and the system is trying to be “smart” by removing the annotation here.
1 Like
GreatOm
3
Thanks for your reply.
I did not thought on the global system settings but there is nothing defined.
Now I tried another shortcut and it works e.g. using "g" instead of "s". Now I need to investigate the reason of my issue. Glad that it is no SwiftUI bug.