Skip to content

Instantly share code, notes, and snippets.

@threeve
Created August 13, 2010 18:53
Show Gist options
  • Save threeve/523357 to your computer and use it in GitHub Desktop.
Save threeve/523357 to your computer and use it in GitHub Desktop.
#import <Foundation/Foundation.h>
@interface Foo : NSObject
@end
@interface Bar : NSObject
@end
@implementation Foo
@end
@implementation Bar
@end
int main (int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSMutableArray *array = [NSMutableArray arrayWithObjects:[Foo new], [Foo new], [Bar new], [Foo new], [Bar new], [Bar new], nil];
NSPredicate *p = [NSPredicate predicateWithFormat:@"self.class == %@", [Foo class]];
NSLog(@"%@\n%@", array, [array filteredArrayUsingPredicate:p]);
[pool drain];
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment