Instance Method


Called when the user selects a Home screen quick action for your app, except when you’ve intercepted the interaction in a launch method.


optional func application(_ application: UIApplication, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void)



Your shared app object.


The quick action for which you are providing an implementation in this method.


Call this block after your quick action implementation completes, returning true or false depending on the success or failure of your implementation code.


A Boolean value indicating whether or not your implementation succeeded.


Implement this method to respond to the user’s selection of a Home screen quick action for your app; call the completion handler, with an appropriate Boolean value, when finished.

It’s your responsibility to ensure the system calls this method conditionally, depending on whether or not one of your app launch methods (application(_:willFinishLaunchingWithOptions:) or application(_:didFinishLaunchingWithOptions:)) has already handled a quick action invocation. The system calls a launch method (before calling this method) when a user selects a quick action for your app and your app launches instead of activating.

The requested quick action might employ code paths different than those used otherwise when your app launches. For example, say your app normally launches to display view A, but your app was launched in response to a quick action that needs view B. To handle such cases, check, on launch, whether your app is being launched via a quick action. Perform this check in your application(_:willFinishLaunchingWithOptions:) or application(_:didFinishLaunchingWithOptions:) method by checking for the shortcutItem launch option key. The UIApplicationShortcutItem object is available as the value of the launch option key.

If you find that your app was indeed launched using a quick action, perform the requested quick action within the launch method and return a value of false from that method. When you return a value of false, the system does not call the application:performActionForShortcutItem:completionHandler: method.

See Also

Continuing User Activity and Handling Quick Actions

func application(UIApplication, willContinueUserActivityWithType: String) -> Bool

Tells the delegate if your app takes responsibility for notifying users when a continuation activity takes longer than expected.

func application(UIApplication, didUpdate: NSUserActivity)

Tells the delegate that the activity was updated.