I have the following Firebase database structure,
"-KSupX7CppMD1zbqIy0y" : {
"addedByUser" : "zQpb7o18VzYsSoTQtT9DNhOqTUn2",
"content" : "Post 1",
"cost" : "20",
"duration" : "Weekly",
"latitude" : "40.7594479995956",
"longitude" : "-73.9838934062393",
"timestamp" : "Fri 30 Sep"
},
"-KSuphuqO6a0lnrJYUkt" : {
"addedByUser" : "zQpb7o18VzYsSoTQtT9DNhOqTUn2",
"content" : "Post 2",
"cost" : "10",
"duration" : "Daily",
"latitude" : "40.7594329996462",
"longitude" : "-73.9846261181847",
"timestamp" : "Fri 30 Sep"
}
I need to filter messages within certain distance parameters (less than 50 m, 100 m, 150 m and 200 m). I can get the coordinate from "longitude" and "latitude", but I'm struggling to filter the messages. Any help would be greatly appreciated.
Thank you very much in advance. New to Firebase and Swift.
source
share