One Logo Pool Ball
AppIntents · IOS API REFERENCE

IntentDonationManager

struct · iOS 16.0+ · SDK 27.1

struct IntentDonationManager

A type you use to teach the system about the actions people take using your app. 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.

Members (2)

method · iOS 16.0+

deleteDonations

TypeScript
deleteDonations(predicate: IntentDonationMatchingPredicate): Promise<Array<IntentDonationIdentifier>>
Swift declaration
@discardableResult func deleteDonations(matching predicate: IntentDonationMatchingPredicate) async throws -> [IntentDonationIdentifier]

Deletes the donations that match the criteria in the specified predicate. - Parameters: - predicate: A predicate that identifies the donations to delete. - Returns: An array with the donation identifiers for each deleted donation. Delete donations as part of your app's overall cleanup and maintenance tasks. You might delete a donation when the data required to perform the action isn't available. For example, if someone deletes app-specific data with an associated entity, delete all of the donations that contain the entity in a required parameter. You might also delete a donation if someone undoes the associated action, or if the actions are no longer relevant.

get · iOS 16.0+

shared

TypeScript
static get shared(): IntentDonationManager
Swift declaration
nonisolated(unsafe) static let shared: IntentDonationManager

The shared instance of this class. Retrieve the shared donation manager and use it to donate app intents or delete existing donations that have become stale.

Skipped declarations

4 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

IntentDonationManager.donate(intent:)

This protocol needs associated types that cannot yet cross the bridge.

IntentDonationManager.donate(intent:result:)

This protocol needs associated types that cannot yet cross the bridge.

IntentDonationManager.donate(intent:)

This protocol needs associated types that cannot yet cross the bridge.

IntentDonationManager.donate(intent:result:)

This protocol needs associated types that cannot yet cross the bridge.

All AppIntents types →