---
title: removeAll()
framework: Swift
role: symbol
role_heading: Instance Method
platforms: [iOS 27.0+, iPadOS 27.0+, Mac Catalyst 27.0+, macOS 27.0+, tvOS 27.0+, visionOS 27.0+, watchOS 27.0+]
path: swift/uniquearray/removeall()
---

# removeAll()

Removes all elements from the array, preserving its allocated capacity.

## Declaration

```swift
mutating func removeAll()
```

## Discussion

Discussion note: O(n), where n is the original count of the array.
