Suggesting Shortcuts to Users

Make suggestions for shortcuts the user may want to add to Siri.


After the user performs an action in your app, the app should donate a shortcut that accelerates user access to the action. However, sometimes there are actions in your app the user hasn’t performed that might be of interest to them. For example, perhaps your soup-ordering app features a special soup every day. The user has never ordered the daily soup special, but they might be interested in the option to add a soup-of-the-day shortcut to Siri. Your app can provide this option by making a shortcut suggestion.

Suggest a Shortcut

To suggest a shortcut to an action that the user hasn't performed but may want to add to Siri, create an INShortcut object with either an INIntent or NSUserActivity object that defines the action. Then add the shortcut to an array. Repeat for each suggestion your app wants to make. After creating the list of shortcut suggestions, call setShortcutSuggestions(_:), passing in the shortcuts.

Listing 1

Suggest shortcuts that the user can add to Siri

import Intents

// Add a user activity to the list of suggestions.
var suggestions = [INShortcut(userActivity: orderFavoriteBeverageUserActivity)]

// Add an intent to the list of suggestions. To create
// a shortcut from an intent, the intent must be valid.
if let shortcut = INShortcut(intent: orderSoupOfTheDayIntent) {

// Suggest the shortcuts.

Update Suggestions

Your list of shortcut suggestions should represent actions that pertain to the user. This list may change over time for reasons such as:

  • The addition or removal of features from your app.

  • A change in the way the user interacts with your app.

To update the shortcut suggestion list, replace the existing list by calling setShortcutSuggestions(_:) and passing in a new list of suggestions. If you want to remove all suggestions made by your app, call the same method passing in an empty array.

Changes to the list of shortcut suggestions don't effect shortcuts the user adds to Siri. For instance, if the user adds the suggested order favorite beverage shortcut to Siri and the app removes the suggestion from the list some time later, that shortcut is still available to the user.