How can I set NSButton's keyEquivalent to the Escape key?

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?

try "\u{1b}"

···

--
C. Keith Ray
Senior Software Engineer / Trainer / Agile Coach
* http://www.thirdfoundationsw.com/keith_ray_resume_2014_long.pdf

On Nov 2, 2017, at 8:39 AM, 李某某 via swift-users <swift-users@swift.org> wrote:

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?
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Or you could try "\\E"

Thanks and regards,
Muthu

···

On 3 Nov 2017, at 12:01 AM, C. Keith Ray via swift-users <swift-users@swift.org> wrote:

try "\u{1b}"

--
C. Keith Ray
Senior Software Engineer / Trainer / Agile Coach
* http://www.thirdfoundationsw.com/keith_ray_resume_2014_long.pdf

On Nov 2, 2017, at 8:39 AM, 李某某 via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:

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?
_______________________________________________
swift-users mailing list
swift-users@swift.org <mailto:swift-users@swift.org>
https://lists.swift.org/mailman/listinfo/swift-users

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users