---
title: persistentIdentifier
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/nsuseractivity/persistentidentifier
---

# persistentIdentifier

A unique and persistent value you use to identify the activity.

## Declaration

```swift
var persistentIdentifier: NSUserActivityPersistentIdentifier? { get set }
```

## Mentioned in

Supporting the creation of Quick Notes

## Discussion

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

### Describing the activity

- [activityType](foundation/nsuseractivity/activitytype.md)
- [title](foundation/nsuseractivity/title.md)
- [keywords](foundation/nsuseractivity/keywords.md)
- [NSUserActivityPersistentIdentifier](foundation/nsuseractivitypersistentidentifier.md)
- [contentAttributeSet](foundation/nsuseractivity/contentattributeset.md)
