// calling
UpdateProfileData(dataToUpdate) { (isUpdated) in
if isUpdated {
self.aboutTableView.reloadData()
print("updatedd")
}
}
func UpdateProfileData (_ dateToUpdate: [String: Any], completionHandler:@escaping (_ success:Bool) -> Void) {
SVProgressHUD.show()
let User = Auth.auth().currentUser
guard let user = User else {
print("Error45")
SVProgressHUD.dismiss()
return
}
let db = Firestore.firestore()
db.collection("Users").document(user.uid).setData(dateToUpdate, merge: true) { (error) in
if error != nil {
print("Error99")
SVProgressHUD.dismiss()
return
}
print("updated")
completionHandler(true)
SVProgressHUD.dismiss()
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter