---
title: "indexPath(for:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uicollectionviewdiffabledatasource-9tqpa/indexpath(for:)"
---

# indexPath(for:)

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

## Declaration

```swift
@MainActor @preconcurrency func indexPath(for itemIdentifier: ItemIdentifierType) -> IndexPath?
```

## Parameters

- `itemIdentifier`: 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:)](uikit/uicollectionviewdiffabledatasource-9tqpa/itemidentifier(for:).md)
