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

C. Keith Ray keithray at mac.com
Thu Nov 2 11:01:28 CDT 2017


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 at 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 at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20171102/1b86f0ff/attachment.html>


More information about the swift-users mailing list