Issue #729
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
@IBAction func copy(_ sender: Any) {
print("copy", sender)
}
@IBAction func paste(_ sender: Any) {
print("paste", sender)
}
}
For delete, we can listen to keyDown in NSWindow
class MyWindow: NSWindow {
override func keyDown(with event: NSEvent) {
super.keyDown(with: event)
guard
let deleteScalar = UnicodeScalar(NSDeleteCharacter),
event.charactersIgnoringModifiers == String(deleteScalar)
else { return }
NotificationCenter.default.post(Notification(name: .didKeyboardDeleteItem))
}
}