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

# remove(_:using:)

Removes the specified object from the tree, using a reference to its containing node.

```
func remove(_ element: ElementType, using node: GKOctreeNode) -> Bool
```

## Parameters

`node`

The node in the tree containing the object.

## 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 or node is not in the tree.

## Discussion

By referencing the node that contains the object to remove, this method can quickly remove an object from the tree without needing to perform an exhaustive search. To make use of this performance optimization, keep a reference to the node returned when you add elements with the [`add(_:at:)`](/documentation/GameplayKit/GKOctree/add(_:at:)) or [`add(_:in:)`](/documentation/GameplayKit/GKOctree/add(_:in:)) methods.

---

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)