persistentIdentifier
A unique and persistent value you use to identify the activity.
Declaration
var persistentIdentifier: NSUserActivityPersistentIdentifier? { get set }Mentioned in
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"