---
title: "fetchIdentifiers(_:)"
framework: swiftdata
role: symbol
role_heading: Instance Method
path: "swiftdata/modelcontext/fetchidentifiers(_:)"
---

# fetchIdentifiers(_:)

Returns an array of persistent identifiers, where each identifier represents a single model that satisfies the criteria of the specified fetch descriptor.

## Declaration

```swift
func fetchIdentifiers<T>(_ descriptor: FetchDescriptor<T>) throws -> [PersistentIdentifier] where T : PersistentModel
```

## Parameters

- `descriptor`: A fetch descriptor that provides the configuration for the fetch.

## Return Value

Return Value The array of persistent identifiers. If no models match the descriptor’s criteria, the array is empty.

## See Also

### Fetching only persistent identifiers

- [fetchIdentifiers(_:batchSize:)](swiftdata/modelcontext/fetchidentifiers(_:batchsize:).md)
