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

# indexPath(for:)

Returns the index path of the given element within the sectioned results.

## Declaration

```swift
final func indexPath(for element: Element) -> IndexPath?
```

## Parameters

- `element`: An element to locate within the sectioned results.

## Return Value

Return Value An index path where [0] is the section index and [1] is the item index, or nil if the object is not found or sections is nil.

## See Also

### Accessing observer results

- [results](swiftdata/resultsobserver/results.md)
- [element(at:)](swiftdata/resultsobserver/element(at:).md)
