---
title: "indexPath(forItemIdentifier:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nscollectionviewdiffabledatasourcereference/indexpath(foritemidentifier:)"
---

# indexPath(forItemIdentifier:)

Returns an index path for the item with the specified identifier in the collection view.

## Declaration

```swift
func indexPath(forItemIdentifier identifier: Any) -> IndexPath?
```

## Parameters

- `identifier`: The identifier of the item in the collection view.

## Return Value

Return Value The item’s index path, or nil if no item is found with the provided item identifier.

## Discussion

Discussion This method is a constant time operation, O(1), which means you can look up an index path from its corresponding item identifier with no significant overhead.

## See Also

### Identifying Items

- [itemIdentifier(for:)](appkit/nscollectionviewdiffabledatasourcereference/itemidentifier(for:).md)
