Can't figure out how to do automatic sorting addresses near the user. I can not understand where to start and how to write code.
I have addresses in my firebase. Addresses have type string (not latitude / longitude). Example:
"Москва, Электрозаводская, 21"
"Москва, Арбат, Староконюшенный переулок, дом 43"
"Москва, улица 1-я Бухвостова, дом 12/11, корпус 53"
I know what need use query from firebase, but how use query, i don't understand now.
It's my code:
class PhotoStudiosViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, UIScrollViewDelegate {
    @IBOutlet weak var tableView: UITableView!
    var theStudios: [Studio] = []
    var studiosRef: DatabaseReference!
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(true)
        tableView.estimatedRowHeight = 475
        tableView.rowHeight = UITableViewAutomaticDimension
        loadDataFromFirebase()
    }
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return theStudios.count
    }
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "tableCell", for: indexPath) as! PhotoStudiosTableViewCell
        cell.addressLabel.text = theStudios[indexPath.row].studioAddress
        return cell
    }
    func loadDataFromFirebase() {
        studiosRef = Database.database().reference(withPath: "Addresses")
        let time = DispatchTime.now() + 0.5 
        studiosRef.observe(.value, with: { (snapshot) in
        DispatchQueue.main.asyncAfter(deadline: time) {
            for imageSnap in snapshot.children {
                let studioObj = Studio(snapshot: imageSnap as! DataSnapshot)
                self.theStudios.append(studioObj)
            }
            self.tableView.reloadData()
        }
    })
}
class Studio {
    var ref: DatabaseReference! 
    var studioAddress: String = ""
    init(snapshot: DataSnapshot) {
        ref = snapshot.ref
        studioName = snapshot.key
        let value = snapshot.value as! NSDictionary 
        studioAddress = value["address"] as? String ?? "---"
    }
}
How to make an automatic sorting addresses near the user using data from firebase?