<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftData",
  "identifier" : "/documentation/SwiftData/ResultsObserver/element(at:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftData"
    ],
    "preciseIdentifier" : "s:9SwiftData15ResultsObserverC7element2atxSg10Foundation9IndexPathV_tF"
  },
  "title" : "element(at:)"
}
-->

# element(at:)

Returns the element at the given index path in the sectioned results.

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

## Parameters

`indexPath`

An index path where `indexPath[0]` is the section index
and `indexPath[1]` is the item index within that section.

## Return Value

The element at the given index path, or `nil` if [`sections`](/documentation/SwiftData/ResultsObserver/sections) is `nil`
or the index path is out of bounds.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)