I'm stuck trying figure out how firebase works in swift. Take for example:
let locationRef = FIRDatabase.database().reference(withPath: "Location")
print("A")
locationRef.observeSingleEvent(of: .value, with: { snapshot in
print("B")
})
print("C")
With the firebase database:
{
"Location" : [ {
"address" : "100 Foo Avenue",
"name" : "Foo"
}, {
"address" : "1800 Bar Street",
"name" : "Bar",
} ]
}
For me, this code will not print B, regardless of where I put the observeSingleEvent (oSE) or what I put inside the oSE . Based on the documentation, I thought that oSE was suppose to trigger once upon running, and then be triggered upon any changes to the firebase database, but I can't get it to trigger. In a previous post here, I did get it to work, but I have no idea how, so some clarification on how oSE triggers would be amazing!