<!--
{
  "availability" : [
    "iOS: 5.0.0 -",
    "iPadOS: 5.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.7.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSFileCoordinator/purposeIdentifier",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSFileCoordinator(py)purposeIdentifier"
  },
  "title" : "purposeIdentifier"
}
-->

# purposeIdentifier

A string that uniquely identifies the file access that was performed by this file coordinator.

```
var purposeIdentifier: String { get set }
```

## Discussion

Coordinated reads and writes performed using the same purpose identifier never block each other, even if they occur in different processes. If you are coordinating file access on behalf of a file presenter, use [`init(filePresenter:)`](/documentation/Foundation/NSFileCoordinator/init(filePresenter:)) and do not attempt to set a custom purpose identifier. Every file coordinator instance initialized with the same file presenter has the same purpose identifier.

You may need to set a custom purpose identifier for the following reasons:

- Your application has a File Provider extension. Any file coordination done on behalf of the File Provider needs to be done using the File Provider’s purpose identifier.
- You have two separate subsystems that need to work together to perform a single high-level operation, and both subsystems perform their own coordinated reads or writes. Using the same purpose identifier in both subsystems prevents possible deadlocks between the two subsystems.

When creating custom purpose identifiers, you can use a reverse DNS style string, such as `com.example.MyApplication.MyPurpose`, or a UUID string. You cannot use `nil` or zero-length strings.

> Note:
> You can set a purpose identifier only once, either implicitly by calling ``doc://com.apple.foundation/documentation/Foundation/NSFileCoordinator/init(filePresenter:)`` or explicitly using this property. Attempting to set the purpose identifier a second time throws an exception.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)