root
|
@--reviews
|
|
@--postABC // postId
|
|
@--reviewXYZ // ***I want everything under this r
The DataSnapshot class has built-in methods to loop over its children.
reviewsRef?.observeSingleEvent(of: .value, with: { [weak self](snapshot) in
for child in snapshot.children {
let snap = child as! DataSnapshot;
print(snap.key)
print(snap.value)
print(snap.childSnapshot(forPath: "buyerUID").value)
}
})
Also see other search results for looping over Firebase child nodes in Swift.