June 2011
Intermediate to advanced
590 pages
19h 31m
English
The newest version of Objective-C added a few syntax changes to the language. One if these is fast enumeration. Before Objective-C 2.0, iterating through an NSArray looked like this:
for (int i = 0; i < [items count]; i++) {
Possession *item = [items objectAtIndex:i];
NSLog(@"%@", item);
}
Now you can write that code segment much more succinctly with fast enumeration in main.m.
for (Possession *item in items) NSLog(@"%@", item); [items release]; items = nil; [pool drain]; ...
Read now
Unlock full access