Created
April 12, 2013 10:27
-
-
Save jlcampana/5371098 to your computer and use it in GitHub Desktop.
Predicate 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
//create predicate and filter the results | |
NSPredicate *distancePredicate = [NSPredicate predicateWithBlock:^BOOL(Establishment *a, NSDictionary *binding) | |
{ | |
CLLocation *myLocation = [[CLLocation alloc] initWithLatitude:[a.latitude doubleValue] | |
longitude:[a.longitude doubleValue]]; | |
return [location distanceFromLocation:myLocation] <= __distance; | |
}]; | |
NSArray *resultado = [shops filteredArrayUsingPredicate:distancePredicate]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment