Adding keyboard shortcuts in your SwiftUI apps is extremely easy. Just use the .keyboardShortcut(_:) modifier. When pressing and holding the command key, the shortcut will appear in the shortcuts list.

Calendar app opened on an iPad. There is a panel that shows the keyboard shortcuts available because the user is pressing and holding the command key. One of them is command + n to create a new event. Applying the .keyboardShortcut(_) modifier with

You may also find interesting...

In SwiftUI there is a very useful modifier accessibilityElement(children:), that will do very different things depending on the AccessibilityChildBehavior passed as a parameter. There are three options: ignore (default), contain, and combine.

In UIKit you can create keyboard shortcuts by overriding the keyCommands for your view controller, which is an array of UIKeyCommand. A bit of a different approach to how you'd do it with SwiftUI.

If you want to keep yourself up to date with what’s going on, or what has been published lately, on how to develop more accessible mobile apps, make sure you subscribe to Accessible Mobile Apps Weekly by @RobinKanatzar from @accessible_apps.

Created in Swift with Ignite.

Supporting Swift for Swifts