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

# remove(_:)

Searches for the specified object and removes it from the tree.

## Declaration

```swift
func remove(_ element: ElementType) -> Bool
```

## Parameters

- `element`: The object to be removed from the tree.

## Return Value

Return Value true if the object was removed from the tree. false if the specified object is not in the tree.

## Discussion

Discussion The tree does not directly reference its elements—quadtrees are optimized to search for elements based on spatial positions—so this method must exhaustively search the entire tree to find the object to remove. For quicker removal, keep a reference to the GKQuadtreeNode object returned when you add an object to the tree, and call the remove(_:using:) method instead.

## See Also

### Adding and Removing Elements

- [add(_:at:)](gameplaykit/gkquadtree/add(_:at:).md)
- [add(_:in:)](gameplaykit/gkquadtree/add(_:in:).md)
- [remove(_:using:)](gameplaykit/gkquadtree/remove(_:using:).md)
