Skip to content

Instantly share code, notes, and snippets.

@PattyAppier
Last active May 30, 2018 08:08
Show Gist options
  • Save PattyAppier/c88df27307d2b9ed70219d6ebb44405c to your computer and use it in GitHub Desktop.
Save PattyAppier/c88df27307d2b9ed70219d6ebb44405c to your computer and use it in GitHub Desktop.
Firebase_DB_codeScript.File_2018-0530
var var1 = false #Boolean Type
fun() {
var1 = false
Database.database()
.reference()
.child("Requests Name")
.queryOrdered(byChild:"value1 name")
.queryEqual(toValue: "alue1 name")
.observe(.childAdded, with: { (snapshot) in
snapshot.ref.removeValue()
Database.database().reference().child("RideRequests").removeAllObservers()
})
}
fun viewDidLoad() {
super.viewDidLoad()
Database.database().reference().child("Requests Name").observe(.childAdded, with: { (snapshot) in
self.passengersRequests.append(snapshot)
self.tableView.reloadData()
})
fun(){
Database.database().reference().child("Requests Name")
.queryOrdered(byChild: "value1 name")
.queryEqual(toValue: get Value for Value1)
.observe(.childAdded, with: {(snapshot) in
snapshot.ref.updateChildValues(["Value2-1":_, "Value2-2" :_])
Database.database().reference().child("Request Name").removeAllObservers()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment