[swift-users] How can I set NSButton's keyEquivalent to the Escape key?

李某某 forucial at icloud.com
Thu Nov 2 10:39:43 CDT 2017


With Objective-C I can simple make it.
[button setKeyEquivalent:"\E"];

However swift doesn’t allow me to do that.
button.keyEquivalent = "\E"
Then I got "Invalid escape sequence in literal".

Is there any solution?


More information about the swift-users mailing list