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

# indexPath(for:)

Returns an index path that represents the row and section of a specified table-view cell.

## Declaration

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

## Parameters

- `cell`: A cell object of the table view.

## Return Value

Return Value An index path representing the row and section of the cell, or nil if the index path is invalid.

## See Also

### Getting cells and section-based views

- [cellForRow(at:)](uikit/uitableview/cellforrow(at:).md)
- [headerView(forSection:)](uikit/uitableview/headerview(forsection:).md)
- [footerView(forSection:)](uikit/uitableview/footerview(forsection:).md)
- [indexPathForRow(at:)](uikit/uitableview/indexpathforrow(at:).md)
- [indexPathsForRows(in:)](uikit/uitableview/indexpathsforrows(in:).md)
- [visibleCells](uikit/uitableview/visiblecells.md)
- [indexPathsForVisibleRows](uikit/uitableview/indexpathsforvisiblerows.md)
