db
{
"people": {
"-MPRm-8iCWsKK6B_nuHA": {
"age": 30,
"mail": "[email protected]",
"name": "taro"
},
}
}
swift
let ref = Database.database().reference().child("people")
ref.observe(DataEventType.value) { (snapshot) in
for child in snapshot.children {
let snap = child as! DataSnapshot
let key = snap.key
let value = snap.value
// key : -MPRm-8iCWsKK6B_nuHA
// value : Optional({ age = 30; mail = "[email protected]"; name = taro; })
}
}
Recommended Posts