<!--
{
  "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/NSFileVersion/version(itemAt:forPersistentIdentifier:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSFileVersion(cm)versionOfItemAtURL:forPersistentIdentifier:"
  },
  "title" : "version(itemAt:forPersistentIdentifier:)"
}
-->

# version(itemAt:forPersistentIdentifier:)

Returns the version of the file that has the specified persistent ID.

```
class func version(itemAt url: URL, forPersistentIdentifier persistentIdentifier: Any) -> NSFileVersion?
```

## Parameters

`url`

The URL of the file whose version you want.

`persistentIdentifier`

The persistent ID of the `NSFileVersion` object you want.

## Return Value

The file version object with the specified ID or `nil` if no such version object exists.

## See Also

[`persistentIdentifier`](/documentation/Foundation/NSFileVersion/persistentIdentifier)

The identifier for this version of the file.



---

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)