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]; return 0; }
Now that we have covered the basics of Objective-C, the next chapter will discuss memory management in Cocoa Touch.
18.118.2.240