Created
October 11, 2019 08:58
-
-
Save sindresorhus/490e7520d07fd7a6d278cb84d73e65a0 to your computer and use it in GitHub Desktop.
Example of using NSButton in SwiftUI to access missing features like `keyEquivalent` (for example, to make the button the default and highlighted). Stack Overflow answer: https://stackoverflow.com/a/58337529/64949
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for this code.
For my purpose I also added
button.keyEquivalentModifierMask
= .command to respond to to the command key as in⌘-s
.I also added
so I could save it in a separate file.