Instance Method


Returns by reference a C array of objects over which the sender should iterate, and as the return value the number of objects in the array.



func countByEnumerating(with state: UnsafeMutablePointer<NSFastEnumerationState>, objects buffer: AutoreleasingUnsafeMutablePointer<AnyObject?>, count len: Int) -> Int



Context information that is used in the enumeration to, in addition to other possibilities, ensure that the collection has not been mutated.


A C array of objects over which the sender is to iterate.


The maximum number of objects to return in stackbuf.

Return Value

The number of objects returned in stackbuf. Returns 0 when the iteration is finished.


The state structure is assumed to be of stack local memory, so you can recast the passed in state structure to one more suitable for your iteration.

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