---
title: "elements(in:)"
framework: gameplaykit
role: symbol
role_heading: Instance Method
path: "gameplaykit/gkquadtree/elements(in:)"
---

# elements(in:)

Returns all objects whose corresponding locations overlap the specified region.

## Declaration

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

## Parameters

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

## Return Value

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

## Discussion

Discussion You specify the point or region corresponding to an object when you add it to the tree with the add(_:at:) or 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.

## See Also

### Searching for Elements

- [elements(at:)](gameplaykit/gkquadtree/elements(at:).md)
