Instance Method


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


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



The object to be removed from the tree.


The node in the tree containing the object.

Return Value

true if the object was removed from the tree. false if the specified object or node is not in the tree.


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:) or add(_:in:) methods.

See Also

Adding and Removing Elements

func add(ElementType, at: vector_float3) -> GKOctreeNode

Adds an object to the tree corresponding to the specified point in 3D space.

func add(ElementType, in: GKBox) -> GKOctreeNode

Adds an object to the tree corresponding to the specified volume of 3D space.

func remove(ElementType) -> Bool

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

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software