Contents

IntentDonationManager

A type you use to teach the system about the actions people take using your app.

Declaration

struct IntentDonationManager

Mentioned in

Overview

Use the shared IntentDonationManager instance to share your app’s actions with the system. When someone completes an interaction with your app, create a relevant app intent and donate it using this type. Over time, the system combines your donations with other information to identify patterns and predict the actions a person might take in the future. System features can then proactively suggest actions on the Lock Screen, in the Siri Suggestions widget, in Search, and in other system interfaces.

Make donations only for actions that people initiate from your app or its interface. For each donation, provide as much detail as you can about the action, and make the donation only after the person completes the action. If the action generates an interesting result, include a result value with your donation. You don’t need to donate app intents that the system creates on your behalf, because the system already donates them for you. For example, if someone uses the Shortcuts app to run one of your app intents, the system donates that app intent and any results automatically.

When a particular action is no longer relevant, delete it to improve the quality of future system suggestions. Make the removal of stale donations a routine cleanup task for your app. For example, you might remove donations when someone deletes the data associated with those donations, or if someone undoes an action shortly after performing it.

This type offers both synchronous and asynchronous methods to donate your app intents. Use the asynchronous methods when you need to know whether a donation succeeds or fails. For example, use the asynchronous methods to identify issues during testing or to ensure a donation actually succeeded in your production code. The asynchronous methods throw an error when a donation fails, while the synchronous methods fail quietly.

Topics

Getting the donation manager

Donating intents to the system

Deleting previous donations

See Also

Donation management