Contents

persistentIdentifier

A value used to identify the user activity.

Declaration

var persistentIdentifier: NSUserActivityPersistentIdentifier? { get set }

Discussion

Set this property to a value that identifies the user activity so you can later delete it with deleteSavedUserActivities(withPersistentIdentifiers:completionHandler:). For example, if the user checks the weather for Cupertino each morning from home, the weather app sets the persistent identifier to the city name (Cupertino). When the user deletes Cupertino from the weather app, the app deletes the user activity associated with the identifier, “Cupertino”.

let userActivity = NSUserActivity(activityType: WeatherLookup.userActivityType)
userActivity.persistentIdentifier = "Cupertino"

See Also

Accessing activity information