Provide Siri relevant shortcuts to display on the Siri watch face.
The Siri watch face can suggest shortcuts to the user based on a situation, time of day, or location. You determine which actions in your app are pertinent to the user and may be something they’d like to do in the future, such as starting a workout when arriving at a gym. Your app tells Siri about these actions by specifying them as relevant shortcuts.
Create a Relevant Shortcut
To let Siri know about relevant shortcuts for your app, start by creating an
INIntent with a system-provided or custom intent, or an
NSUser object for each action. Next, create an
INShortcut object for each intent and user activity. Use the shortcut to create an
INRelevant object, and set the
shortcut to provide a hint to Siri as to the purpose of the shortcut: to perform an action or display information.
Add Relevance Providers
To give Siri a hint about when to suggest the shortcut to the user, add one or more providers to the
relevance property on the relevant shortcut. Relevance providers let you specify parameters such as a particular situation, date, time, and location that indicate the shortcut may be relevant to the user. For example, you can instruct Siri to suggest starting a workout when the user arrives at the gym.
Don't combine an
INDaily for a time-based situation with an
INDaily and 8 p.m.; the outcome can be unpredictable. Instead, provide multiple relevant shortcuts for each scenario, that is, provide a relevant shortcut for
INDaily and a second one for 8 p.m.
Applying multiple locations relevance providers to a relevant shortcut creates similar problems. Instead, provide a relevant shortcut for each location.
Set Relevant Shortcuts
Continue creating the relevant shortcuts for your app, storing each one in an array. After you've created and stored the shortcuts, inform Siri of the relevant shortcuts by using the
default relevant shortcut store to call
set, passing in the array of relevant shortcuts.
Replace Relevant Shortcuts
There isn't a way to add relevant shortcuts to the list already set by your app. Instead, you must replace the list by following the same steps previously mentioned:
Gather the actions (as user activities or intents) and create an array of
Pass the array to
Relevant Shortcuts(_: completion Handler:)
When you've completed these steps, the new set of relevant shortcuts takes the place of the previous one. If you want to delete all relevant shortcuts defined by your app, call
set, passing in an empty array.
Replace the list when your app needs to add or remove a relevant shortcut. It isn't necessary to replace the list more than once a day, and resubmitting the same set of relevant shortcuts more often provides no benefits.