Initializes and returns a location sort descriptor object.
- iOS 8.0+
- macOS 10.10+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 3.0+
The name of the key whose value is a
CLLocationobject. The key must belong to the records being sorted. The sort descriptor uses this key to retrieve the corresponding value from the record.
The reference location to use when sorting. Records are sorted based on their distance to this location.
An initialized location sort descriptor object, or
nil if the object cannot be initialized.
During sorting, the sort descriptor computes the distance between the value in the
relative parameter and the location value found in the specified key of each record. It then sorts the records in ascending order using the distance between the two points. You cannot change the sort order.