Can I improve my Firebase structure?
<p>I'm building an 2 order app,one for the customer to post orders the other for drivers to accept, so from the other app i don't have access to user id, its barely working, but a headache to deal Firebase, now i'm trying to add/read new orders to my data structure but couldn't figure how to read just the new orders without creating a whole bunch of loops to sift through the data, so when i detect a change in data, i delete everything and load all the data again, </p>

<p><a href="https://i.stack.imgur.com/WNM7p.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WNM7p.png" alt="enter image description here"></a></p>

<p>here is my code </p>

<pre><code>    override func viewDidLoad() {
    super.viewDidLoad()





    loadData()


    ref.observe(.childChanged, with: { snapshot in
        print("\n\n\nthe changed user is: \(snapshot.value)\n\n\n")
        self.usrData.removeAll() //if change is detected, remove     everything then readd them

        self.loadData() //load firebase Data to my data structure
    })

}
</code></pre>

<p>here is my load data method </p>

<pre><code> func loadData(){

    ref.observe(.childAdded, with: { snapshot in
        if let result = snapshot.children.allObjects as? [FIRDataSnapshot] {
            print("snapshot.value is snapshot \(snapshot.valueInExportFormat())")

            if let tes = snapshot.value as? Dictionary&lt;String, AnyObject&gt; {
                print("snapshot dictionarty is snapshot \(tes.reversed())")



                let est = tes.reversed()

                for t in est {
                    print("snapshot dictionarty name snapshot \(t.value["name"] as! String)")
                    print("snapshot dictionarty name snapshot \(t.value["email"] as! String)")
                    print("snapshot dictionarty name key \(t.key)")



                    let usr = userData(name: t.value["name"] as! String, email: t.value["email"] as! String, mobile: "", date: 0, latitude: "", longititude: "", ordertxt: "", status: "", usrKey:t.key, orderNumb:"")

                    self.usrData.append(usr)

                }

            }

            var count = 0


            for child in result {

                let  dict = child.childSnapshot(forPath: "orders").value as! Dictionary&lt;String, AnyObject&gt;
                print("dict is \(dict)")


                for dic in dict {

                    if  (dic.value["status"] as! String) == "pending" {

                        self.usrData[count].mobile = dic.value["mobile"] as! String
                        self.usrData[count].date = dic.value["date"] as! NSNumber
                        self.usrData[count].latitude = dic.value["latitude"] as! String
                        self.usrData[count].longititude = dic.value["longitude"] as! String
                        self.usrData[count].ordertxt = dic.value["orderText"] as! String
                        self.usrData[count].status = dic.value["status"] as! String
                        self.usrData[count].orderNumb = dic.key

                        print("\(count) dic key is\(dic.key)")

                    } else {
                        print("\n\n\n status isn't pending for some reason -&gt; \(self.usrData[count].status)")
                        self.usrData.remove(at: count)
                        count-=1
                        continue
                    }

                }
                count += 1
            }
        } else {
            print("\n\n result is nil or something\n\n");
        }


        self.tableView.reloadData()

    })



}
</code></pre>

<p>anyway to improve it?</p>