Creates and returns a mutable set with a given initial capacity.
SDKs
- iOS 2.0+
- macOS 10.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Foundation
Declaration
+ (instancetype)setWithCapacity:(NSUInteger)numItems;
Parameters
numItems
The initial capacity of the new set.
Return Value
A mutable set with initial capacity to hold num
members.
Discussion
Mutable sets allocate additional memory as needed, so num
simply establishes the object’s initial capacity.