An interaction between the user and your app involving an intent object.


class INInteraction : NSObject


An INInteraction object encapsulates information about a SiriKit request and your app’s response. SiriKit creates interaction objects automatically when it needs to launch your app to facilitate the handling of, or respond to errors involving, a specific intent. The interaction object is placed in the NSUserActivity object that the system passes to your app at launch time. You can also create instances of this class in your app and donate relevant interactions to the system.

Donating interactions is a way to provide contextual information that might be helpful to other apps. Some system apps use donated interactions to improve search results or to anticipate user actions. For example, a ride-booking app could donate an interaction containing the user’s planned ride information. If the user subsequently uses the Maps app to search for restaurants, Maps can show relevant results near the user’s destination.

You choose which of your app’s interactions you want to donate to the system. To donate an interaction, create an instance of this class, filling it with your intent object and response, and call the donate(completion:) method. You can also use the methods of this class to delete interactions when they are no longer relevant.


Creating an Interaction Object

init(intent: INIntent, response: INIntentResponse?)

Initializes and returns an interaction object with an intent object and your app’s response.

Getting the Intent and Response

var intent: INIntent

The intent object that describes the user’s request.

var intentResponse: INIntentResponse?

The response object that your app created in response to the request.

Donating Interactions to the System

func donate(completion: ((Error?) -> Void)?)

Donates this interaction object to the system.

Deleting Interactions from the System

class func deleteAll(completion: ((Error?) -> Void)?)

Deletes all interactions that you donated previously.

class func delete(with: [String], completion: ((Error?) -> Void)?)

Deletes the specified interactions that were donated by the calling app.

class func delete(with: String, completion: ((Error?) -> Void)?)

Deletes the interactions with the specified group identifier.

Accessing Interaction Attributes

var intentHandlingStatus: INIntentHandlingStatus

The current state of the interaction.

var direction: INInteractionDirection

The direction in which information flowed to or from the device.

var dateInterval: DateInterval?

The time at which the interaction started and its duration.

var identifier: String

The unique identifier of the interaction.

var groupIdentifier: String?

The unique identifier of the interaction’s group.

Getting the Value of a Parameter

func parameterValue(for: INParameter) -> Any?

Returns the value of the specified parameter of this interaction object.


enum INIntentHandlingStatus

Constants indicating the current state of the interaction.

enum INInteractionDirection

Constants indicating whether the app is providing or receiving information.


Inherits From

See Also


Donating Shortcuts

Tell Siri about shortcuts to actions that the user performed in your app.

Deleting Donated Shortcuts

Remove your donations from Siri.

Soup Chef: Accelerating App Interactions with Shortcuts

Make it easy for people to use Siri with your app by providing shortcuts to your app’s actions.

Shortcut Management

Enable users to add shortcuts to Siri, and have your app suggest shortcuts to users.

Relevant Shortcuts

Display shortcuts on the Siri watch face.

Media Intent Shortcuts

Provide a convenient way for users to listen to and watch media content from your app with shortcuts.

enum INShortcut

An action available in your app that the system may suggest to a user or a user may add to Siri.

class INObject

An object that represents a custom intent parameter.