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

# init(capacity:)

Returns an array, initialized with enough memory to initially hold a given number of objects.

## Declaration

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

## Parameters

- `numItems`: The initial capacity of the new array.

## Return Value

Return Value An array initialized with enough memory to hold numItems objects. The returned object might be different than the original receiver.

## Discussion

Discussion Mutable arrays expand as needed; numItems simply establishes the object’s initial capacity. This method is a designated initializer.

## See Also

### Creating and Initializing a Mutable Array

- [init(contentsOfURL:)](foundation/nsmutablearray/init(contentsofurl:).md)
- [init()](foundation/nsmutablearray/init().md)
