---
title: "clone(capacity:)"
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/clone(capacity:)"
---

# clone(capacity:)

Copy the contents of this array into a newly allocated unique array instance with the specified capacity.

## Declaration

```swift
func clone(capacity: Int) -> UniqueArray<Element>
```

## Parameters

- `capacity`: The desired capacity of the resulting unique array. capacity must be greater than or equal to count.

## Discussion

Discussion note: O(count)
