I have an app using both AppKit and SwiftUI. In SwiftUI I can use the code below to activate the delete
action under edit
and the Mac "invalid key" tone doesn't sound. I can't figure out how to support this behavior in AppKit though. I have a view that is the first responder, and added the code below:
SwiftUI view:
.onDeleteCommand {
...
}
AppKit:
override func deleteBackward(_ sender: Any?) {
super.deleteBackward(sender)
}
but it is never called. I also tried override func responds(to aSelector: Selector!) -> Bool {
but it doesn't work either. How can I support this?