Instance Method

shortcut(_:holding:)

Sets the keyboard shortcut/key equivalent.

Declaration

func shortcut(_ shortcut: String, holding modifiers: NSEvent.ModifierFlags = .command) -> Self

Example


MenuItem("Quit")
    .shortcut("q")
MenuItem("Commit…")
    .shortcut("c", holding: [.option, .command])

See Also

Behavior