Contents

donate(intent:result:)

Donates the specified app intent and result to the system synchronously.

Declaration

@discardableResult func donate(intent: some AppIntent, result: some IntentResult) -> IntentDonationIdentifier

Parameters

  • intent:

    An app intent for an action your app performed. Put enough information into the app intent that your app can replicate the action later.

  • result:

    A significant result to the action. For example, specify a result that triggers a follow-up app intent.

Return Value

A unique identifier you can use to refer to the donation later. The method returns this value whether the donation succeeds or fails.

Discussion

When someone completes an action in your app, call this method to donate a matching app intent and result. The system doesn’t run the app intent you provide, but uses the information to predict future actions. If an error occurs during the donation process, this method ignores the error.

See Also

Donating intents to the system