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

# init(capacity:)

Returns an NSMutableString object initialized with initial storage for a given number of characters,

## Declaration

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

## Parameters

- `capacity`: The number of characters the string is expected to initially contain.

## Return Value

Return Value An initialized NSMutableString object with initial storage for capacity characters. The returned object might be different than the original receiver.

## Discussion

Discussion The number of characters indicated by capacity is simply a hint to increase the efficiency of data storage. The value does not limit the length of the string.
