FastEnumerationSample

Last Revision:
Version 1.0, 2009-12-07
Demonstrates how to implement the NSFastEnumeration protocol.
Build Requirements:
Xcode 3.1.2, Mac OS X 10.5
Runtime Requirements:
Mac OS X 10.5 or iPhone OS 3.0

A Mac OS X command line project that demonstrates how to implement the NSFastEnumeration protocol. In this sample the MyFastEnumerationSample class implements -countByEnumeratingWithState:objects:count: to return strings on demand. This sample avoids considering how you may implement a storage class, whereas a real implementation would likely need to do less work to provide values, such as directly copying object pointers from an internal representation. Regardless of your class's actual implementation, adopting the NSFastEnumeration protocol also allows you to use the for...in syntax to access your containers objects.


Did this document help you? Yes It's good, but... Not helpful...