Fast enumeration of an NSArray
suggest changeThis 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
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents