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

# indexPath(for:)

Gets the index path of the specified cell.

## Declaration

```swift
func indexPath(for cell: UICollectionViewCell) -> IndexPath?
```

## Parameters

- `cell`: The cell object whose index path you want.

## Return Value

Return Value The index path of the cell or nil if the specified cell is not in the collection view.

## See Also

### Locating items and views in the collection view

- [indexPathForItem(at:)](uikit/uicollectionview/indexpathforitem(at:).md)
- [indexPathsForVisibleItems](uikit/uicollectionview/indexpathsforvisibleitems.md)
- [cellForItem(at:)](uikit/uicollectionview/cellforitem(at:).md)
- [indexPathsForVisibleSupplementaryElements(ofKind:)](uikit/uicollectionview/indexpathsforvisiblesupplementaryelements(ofkind:).md)
- [supplementaryView(forElementKind:at:)](uikit/uicollectionview/supplementaryview(forelementkind:at:).md)
- [visibleSupplementaryViews(ofKind:)](uikit/uicollectionview/visiblesupplementaryviews(ofkind:).md)
