I am looking for a query for CloudKit that can return me objects with the objects closest to my location, sorted by distance. So far I can get places at a certain distance from my point.
NSPredicate(format: "distanceToLocation:fromLocation:(%K,%@) < %f","Location",location,radiusInKilometers)
But that is not what I need. What I'm looking for is locations sorted from the nearest one, the radius does not matter to me, so the decision to use this query and sort the results on my device is not suitable for me. Any help?
source
share