You can use a block-based predicate like this:
NSSet *yourSet = ...;
NSPredicate *pred = [NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) {
return [evaluatedObject isKindOfClass:[CircleShape class]];
}];
NSSet *filteredSet = [yourSet filteredSetUsingPredicate:pred];
This would return all instances of CircleShape
or subclasses of CircleShape
. Use isMemberOfClass
if you want only instances of the class, but not of subclasses.