Type Method

dictionaryWithCapacity:

Creates and returns a mutable dictionary, initially giving it enough allocated memory to hold a given number of entries.

Declaration

+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;

Parameters

numItems

The initial capacity of the new dictionary.

Return Value

A new mutable dictionary with enough allocated memory to hold numItems entries.

Discussion

Mutable dictionaries allocate additional memory as needed, so numItems simply establishes the object’s initial capacity.

See Also

Creating and Initializing a Mutable Dictionary

- initWithCapacity:

Initializes a newly allocated mutable dictionary, allocating enough memory to hold numItems entries.

- init

Initializes a newly allocated mutable dictionary.

+ dictionaryWithSharedKeySet:

Creates a mutable dictionary which is optimized for dealing with a known set of keys.

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