I have an array of objects. On this object is a NSDecimalNumber property distanceFromDevice.
I want to order this array by this property. I have struggled for hours with sorting, anyone got any advice?
- (void)buildSearchableListUsing:(CLLocation *)newLocation
{
listContent = [[NSMutableArray alloc] init];
for(NSAirport *regionalAirport in airportsList)
{
CLLocation *location = [[CLLocation alloc]initWithLatitude:[regionalAirport.latitude doubleValue] longitude:[regionalAirport.longitude doubleValue]];
regionalAirport.distanceFromDevice = [[NSDecimalNumber alloc]initWithDouble:[newLocation distanceFromLocation:location]];
NSLog(@"distanceFromDevice %@", regionalAirport.distanceFromDevice);
[listContent addObject:regionalAirport];
}
//I want listContent ordered by the property distanceFromDevice
}