0 votes
in Technology by (1.7m points)
What is fast enumeration in Objective-C?

1 Answer

0 votes
by (1.7m points)

The object is usually a collection such as an array or set Several Cocoa classes, including the collection classes, adopt the NSFastEnumeration protocol. You use it to retrieve elements held by an instance using a syntax similar to that of a standard C for loop, as illustrated in the following example:

NSArray *anArray = // get an array;

for (id element in anArray)


/* code that acts on the element */