How do I detect if an object implements NSFastEnumeration protocol in Objective-C? [closed]
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>
Something like this:
BOOL canBeFast = [yourCollection conformsToProtocol:@protocol(NSFastEnumeration)];
精彩评论