Snippets Collections
   let User = Auth.auth().currentUser
        if let user = User{
            let db = Firestore.firestore()
            db.collection("Appointments").whereField("patient_id", isEqualTo: user.uid).getDocuments { [self] (document, error) in
                guard let data = document?.documents else {
                    return
                }
                      for d in data{
                    self.chatStatus = d.get("chat_status") as? String ?? ""
                    self.startTime = d.get("start_time") as? String ?? ""
                }
                      //updating data
                    let document = document!.documents.first
                    document?.reference.updateData([
                                   "chat_status": "Started"
                               ])
star

Thu Jan 27 2022 08:01:04 GMT+0000 (Coordinated Universal Time)

#ios #swift #getandupdate #data #getandupdatedata

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension