Swift Firebase -How to get all the k/v when using queryOrdered(byChild: ).queryEqual(toValue: )

前端 未结 1 1938
我在风中等你
我在风中等你 2021-01-28 03:39
root
  |
  @--reviews
        |
        |
        @--postABC // postId
               |
               |
               @--reviewXYZ // ***I want everything under this r         


        
相关标签:
1条回答
  • 2021-01-28 04:06

    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.

    0 讨论(0)
提交回复
热议问题