Version 1.0, 2009-12-07
Demonstrates how to implement the NSFastEnumeration protocol.
Xcode 3.1.2, Mac OS X 10.5
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.
© 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-12-07)