Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

macOS Keyboard Shortcuts in Swift

I am creating a macOS app and would like to create a keyboard shortcut for when the user taps the space bar for one of my buttons.

I am not sure where I should start and even where the documentation is for this? What should I be looking for?

like image 264
Tom Coomer Avatar asked Jan 02 '15 14:01

Tom Coomer


People also ask

Does SwiftKey have Shortcuts?

Access your SwiftKey keyboard shortcuts by heading into your Rich Input settings. Tap the three-dots menu in the right-hand corner of the toolbar, and then select Settings > Rich input. Here, tap on Clipboard and then select Add a new clip. From here, you can define your new text shortcut.

How do you set up keyboard shortcuts on a Mac?

Customize keyboard shortcuts On your Mac, choose Apple menu > System Preferences, click Keyboard , then click Shortcuts. In the list on the left, select a category, such as Mission Control or Spotlight. In the list on the right, select the checkbox next to the shortcut that you want to change.


1 Answers

You can now add keyboard shortcuts for many of your UI elements directly in a storyboard, by clicking on the Attribute inspector and scrolling down to "Key Equivalent". You just click in the Key Equivalent text field and press the key equivalent on your keyboard.

like image 161
Matt Avatar answered Sep 18 '22 17:09

Matt