Created
February 8, 2012 09:29
-
-
Save vibrazy/1767170 to your computer and use it in GitHub Desktop.
NSPredicate With Block
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BOOL proVersion = YES; | |
if (proVersion) { | |
return; | |
} | |
//create predicate and filter the results | |
NSPredicate *freePredicate = [NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *binding) { | |
InAppGame *game = (InAppGame *)evaluatedObject; | |
return game.isFree; | |
}]; | |
NSArray *filteredArrays = [resultsArray filteredArrayUsingPredicate:freePredicate]; | |
if ([filteredArrays count] > 0) { | |
[self.resultsArray removeAllObjects]; | |
[self.resultsArray addObjectsFromArray:filteredArrays]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment