---
title: "init(capacity:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/nsmutableset/init(capacity:)"
---

# init(capacity:)

Returns an initialized mutable set with a given initial capacity.

## Declaration

```swift
init(capacity numItems: Int)
```

## Parameters

- `numItems`: The initial capacity of the set.

## Return Value

Return Value An initialized mutable set with initial capacity to hold numItems members. The returned set might be different than the original receiver.

## Discussion

Discussion Mutable sets allocate additional memory as needed, so numItems simply establishes the object’s initial capacity. This method is a designated initializer for NSMutableSet.

## See Also

### Creating a mutable set

- [init()](foundation/nsmutableset/init().md)
