Quick Actions In Swift


Apple has added quick actions to the app icon so users can deep link into an area of your app quicker. By pressing the app icon of the latest devices, the user obtains a set of quick actions. When the user selects a quick action, your app activates or launches and your app delegate object receives the quick action message.


In app’s Info.plist file create a UIApplicationShortcutItems array. This is where we define what the actions are, the title, subtitle, and short cut keys for each. Note that you can only have a max of 4 quick actions off the icon in app.

UIApplicationShortcutItemType – A required string delivered to your app when the user invokes the corresponding quick action.

UIApplicationShortcutItemTitle – A required string displayed to the user on the Home screen as the name of the quick action.

UIApplicationShortcutItemSubtitle – An optional string that is displayed to the user on the Home screen, immediately below the corresponding title string.

UIApplicationShortcutItemIconType – An optional string specifying the type of an icon from the system-provided library.

UIApplicationShortcutItemIconFile – An optional string specifying an icon image to use from the app’s bundle, or the name of an image in an asset catalog.

UIApplicationShortcutItemUserInfo – An optional, app-defined dictionary. One use for this dictionary is to provide app version information.

Next you can run your app and test to see if the quick actions are formatted the way you expected them to look.

Note: You must develop on a device that supports 3D Touch. The simulator in Xcode does not support 3D Touch.


Begin by adding the enum and properties we are going to need in the methods. If you don’t want to use enums, then make sure your names match the UIApplicationShortcutItemType values entered in your Info.plist.

Read in the UIApplicationShortcutItem that is selected by the User in the didFinishLaunchingWithOptions method. Here we are saving that value into launchedShortcutItem so we can handle it next.

The next method to get called is applicationDidBecomeActive, this method gets called after didFinishLaunchingWithOptions during the first launch of your app, or every time the user comes into your app while it’s still open in the background.

When a user chooses one of the quick actions the app launches or resumes the app and calls the performActionForShortcutItem method in your app delegate.

Lastly we need to handle the short cut and deep link the user into the proper view controller within our app.

You can download completed quick action demo project here.

About the author

By Snehal