Fast enumeration of an NSArray

suggest change

This example uses fast enumeration to traverse an NSArray.

When you have an array, such as

NSArray *collection = @[@"fast", @"enumeration", @"in objc"];

Use for…in to visit each item, starting at index 0 and stopping after the last item:

for (NSString *item in collection) {
    NSLog(@"item: %@", item);
}

In this example, the output generated would look like

item: fast
item: enumeration
item: in objc

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents