3

I am developing an app which allows users to search nearby place according to the radius provided by the user. I have some places stored in a realm database with the latitude and longitude of that place. I am able to get the users current latitude and longitude but i don't know how to implement the logic to present the user with places that are closest to him. I can calculate the distance between users current location and a particular location using CLLocationDistance = currentlocation.distanceFromLocation(destinationLocation). Please point me in the right direction or provide me with a sample code. If it's not possible with Realm then let me know which database solution is the best option.

sunny k
  • 330
  • 1
  • 4
  • 13

1 Answers1

1

This isn't currently possible in native Realm queries, but it's something that's actively being worked on! (see https://github.com/realm/realm-cocoa/pull/2199 for a current pull request)

segiddins
  • 4,110
  • 1
  • 17
  • 22