get the CLLocation for your currentPosition (this is done via CLLocationManager)
calculate the distances for each item and store distance+item as a Pair in a Dictionary
Sort Dictionary allKeys array with compare: selector
so
CLLocation *current = ...;
NSMutableDictionary *distsAndTasks [NSMutableDictionary dictionary];
for(id task in allTasks) {
CLLocation *taskLoc = [[CLLocation alloc] initWithLatitude:task.lat longitude:task.long];//!
CLLocationDistance dist = [taskLoc distanceFrom:current];
if(distsAndTasks[@(dist)]) {
NSMutableArray *equidstants = [distsAndTasks[@(dist)] mutableCopy];
[equidstants addObject:task];
distsAndTasks[@(dist)] = equidstants;
}
else {
distsAndTasks[@(dist)] = @[task];
}
}
NSArray *sortedDists = [distsAndTasks.allKeys sortedArrayUsingSelector:@selector(compare:)];
//the tasks can now be access in a sorted way
for(NSNumber *dist in sortedDists) {
NSArray *tasksAtDistance = distsAndTasks[dist];
NSLog(@"%@", tasksAtDistance);
}