<!--
{
  "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/remove(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "GameplayKit"
    ],
    "preciseIdentifier" : "c:objc(cs)GKQuadtree(im)removeElement:"
  },
  "title" : "remove(_:)"
}
-->

# remove(_:)

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

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

## Parameters

`element`

The object to be removed from the tree.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the object was removed from the tree. <doc://com.apple.documentation/documentation/Swift/false> if the specified object is not in the tree.

## 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`](/documentation/GameplayKit/GKQuadtreeNode) object returned when you add an object to the tree, and call the [`remove(_:using:)`](/documentation/GameplayKit/GKQuadtree/remove(_:using:)) method instead.

---

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)