Contents

init(capacity:)

Returns a counted set object initialized with enough memory to hold a given number of objects.

Declaration

init(capacity numItems: Int)

Parameters

  • numItems:

    The initial capacity of the new counted set.

Return Value

A counted set object initialized with enough memory to hold numItems objects

Discussion

The method is the designated initializer for NSCountedSet.

Note that the capacity is simply a hint to help initial memory allocation—the initial count of the object is 0, and the set still grows and shrinks as you add and remove objects. The hint is typically useful if the set will become large.

See Also

Related Documentation

Initializing a Counted Set