KeyboardKit icon indicating copy to clipboard operation
KeyboardKit copied to clipboard

Add extensions for SwiftUI's `KeyboardShortcut`

Open sebj opened this issue 2 years ago • 0 comments

Add extensions on SwiftUI's KeyboardShortcut with common keyboard shortcuts, based on those already defined as part of KeyboardBarButtonItem and elsewhere elsewhere in KeyboardKit.

It seems difficult to provide much utility for SwiftUI compared to what exists for UIKit at the moment, but I thought this might be useful at the very least.

For some background, SwiftUI has .keyboardShortcut view modifier out-of-the-box that takes either a KeyboardShortcut or a KeyEquivalent (key without modifier), but this modifier can only be applied to a Button or Toggle to perform their existing action. KeyboardShortcut only has two existing defined cases for cancelAction (escape) and defaultAction (enter).

sebj avatar Aug 21 '22 16:08 sebj