---
title: "init(minimumCapacity:)"
framework: swift
role: symbol
role_heading: Initializer
path: "swift/set/init(minimumcapacity:)"
---

# init(minimumCapacity:)

Creates an empty set with preallocated space for at least the specified number of elements.

## Declaration

```swift
init(minimumCapacity: Int)
```

## Parameters

- `minimumCapacity`: The minimum number of elements that the newly created set should be able to store without reallocating its storage buffer.

## Discussion

Discussion Use this initializer to avoid intermediate reallocations of a set’s storage buffer when you know how many elements you’ll insert into the set after creation.

## See Also

### Creating a Set

- [init()](swift/set/init().md)
- [init(_:)](swift/set/init(_:)-9cgks.md)
- [init(_:)](swift/set/init(_:).md)
