<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.12.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "GameplayKit",
  "identifier" : "/documentation/GameplayKit/GKQuadtree/elements(in:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "GameplayKit"
    ],
    "preciseIdentifier" : "c:objc(cs)GKQuadtree(im)elementsInQuad:"
  },
  "title" : "elements(in:)"
}
-->

# elements(in:)

Returns all objects whose corresponding locations overlap the specified region.

```
func elements(in quad: GKQuad) -> [ElementType]
```

## Parameters

`quad`

The axis-aligned rectangle in 2D space to search.

## Return Value

An array of all matching elements, or an empty array if no objects are found.

## Discussion

You specify the point or region corresponding to an object when you add it to the tree with the [`add(_:at:)`](/documentation/GameplayKit/GKQuadtree/add(_:at:)) or [`add(_:in:)`](/documentation/GameplayKit/GKQuadtree/add(_:in:)) method. This method follows the same path down the tree as the two `addElement` methods, but instead of adding a new object to the tree, returns the list of all objects stored in the tree node corresponding to the specified point.

---

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)