---
title: "removeAll(keepCapacity:)"
framework: realitykit
role: symbol
role_heading: Instance Method
path: "realitykit/scene/anchorcollection/removeall(keepcapacity:)"
---

# removeAll(keepCapacity:)

Removes all anchors from the collection.

## Declaration

```swift
@MainActor @preconcurrency func removeAll(keepCapacity: Bool = false)
```

## Parameters

- `keepCapacity`: Pass true to keep the existing capacity of the array after removing its elements. The default value is false.

## See Also

### Removing anchors

- [remove(_:)](realitykit/scene/anchorcollection/remove(_:).md)
- [remove(at:)](realitykit/scene/anchorcollection/remove(at:).md)
- [removeAll()](realitykit/scene/anchorcollection/removeall().md)
