---
title: "indexPathsForRows(in:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uitableview/indexpathsforrows(in:)"
---

# indexPathsForRows(in:)

Returns an array of index paths, each representing a row that the specified rectangle encloses.

## Declaration

```swift
func indexPathsForRows(in rect: CGRect) -> [IndexPath]?
```

## Parameters

- `rect`: A rectangle defining an area of the table view in local coordinates.

## Return Value

Return Value An array of NSIndexPath objects each representing a row and section index identifying a row within rect. Returns an empty array if there aren’t any rows to return.

## 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)
- [indexPath(for:)](uikit/uitableview/indexpath(for:).md)
- [indexPathForRow(at:)](uikit/uitableview/indexpathforrow(at:).md)
- [visibleCells](uikit/uitableview/visiblecells.md)
- [indexPathsForVisibleRows](uikit/uitableview/indexpathsforvisiblerows.md)
