1

I want to use fast enumeration on an object of type id.

Basically I'm missing the check here:

id object = <get object form somewhere>;
if( <check if object implements fast enumeration> )
    for (id item in id<NSFastEnumeration>object)
        <process item>
Mihai Timar
  • 1,141
  • 13
  • 21
ma11hew28
  • 121,420
  • 116
  • 450
  • 651
  • 3
    hmm, what? Not only would people who understand the question react negatively to "Please write the code" injunctions, but how are these people supposed to even find the question the way it is tagged? In what context is this? Is "fast enumeration" the programming language your are using? – Pascal Cuoq May 23 '11 at 22:07
  • Since you mentioned "selectors" Im guessing obj-c...I'd re-tag the question for sure. – mr-sk May 23 '11 at 22:10
  • @itripn got it, but I added the objective-c tag and in title. – ma11hew28 May 24 '11 at 17:49

1 Answers1

4

Something like this:

BOOL canBeFast = [yourCollection conformsToProtocol:@protocol(NSFastEnumeration)];
itripn
  • 84
  • 7