Initializer

init(capacity:)

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

Declaration

init(capacity numItems: Int)

Parameters

numItems

The initial capacity of the new array.

Return Value

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

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()

Initializes a newly allocated array.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software