Class

INPerson

Contains information about a user involved in a SiriKit interaction.

Overview

SiriKit uses INPerson objects to represent users with many different roles, including the sender or recipient of calls and messages, the payer or payee of a financial transaction, or the driver of a vehicle. You also use person objects to identify the corresponding user in your app and to communicate information about that user back to SiriKit.

When resolving the parameters of an intent, use any provided INPerson objects to identify the corresponding users in your app. A person object contains whatever information is provided with the initial request, which could be as little as a single name spoken by the user. (If the customIdentifier property has a value, you can use it to retrieve additional information from the Contacts database.) After identifying the user, create a new INPerson object and fill it with the information that you need to identify the user again later. For example, you might specify a value for personHandle property that contains the information about how your app identifies the user.

When resolving the identities of people, SiriKit leverages the information in the user’s contacts database when that information is available. If your app was denied access to the user’s contacts, SiriKit cannot use that information, which might cause many properties of a person object to be nil. Because the INPerson class conforms to the INSpeakable protocol, though, SiriKit still populates the spokenPhrase property with what the user said, and you can use that information to try to identify the user. For more information about that protocol, see INSpeakable.

Topics

Getting the User's Name

var displayName: String

The formatted name of the user.

var nameComponents: PersonNameComponents?

The actual name of the user specified as a set of name components.

Getting Identifiying Information

var handle: String?

The unique identifier that your app assigned to the user.

Deprecated
var personHandle: INPersonHandle?

The unique handle that your app assigned to the user.

var image: INImage?

An image of the person.

var isMe: Bool

A Boolean indicating whether the person is the current user of the device.

var aliases: [INPersonHandle]?

An array of alternate identifiers for the user.

Getting Person-Related Identifiers

var contactIdentifier: String?

The identifier associated with a user record in the Contacts database.

var customIdentifier: String?

The custom identification string that your app uses to identify the user.

Getting Other Information

var suggestionType: INPersonSuggestionType

The type of contact information to donate with interactions.

enum INPersonSuggestionType

Constants indicating how to display the person’s identity.

Identifiying a Person by Relationship

var relationship: INPersonRelationship?

The relationship of this person to the current user.

Getting Matching Persons

var siriMatches: [INPerson]?

A list of possible matches suggested by Siri.

See Also

Contacts

class INPersonHandle

Contains identifying information for a user of your app.

struct INPersonHandleLabel

Constants describing how the person handle relates to the user.