Pagination/Infinite Scroll with Firebase

前端 未结 1 1660
别跟我提以往
别跟我提以往 2021-01-17 18:19

I have sub-nodes of a node which I created with childByAutoId(). I am trying to do pagination for using it in TableView however I couldn\'t figure out how.

1条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-17 19:15

    You need to add last timestamp with each sub node and then query

    firebaseRef.child("user_id").queryOrdered(byChild: "timestamp").queryEnding(atValue: lastTimeStamp - 1).queryLimited(toLast: 10).observe(.value, with: { (snapshot) in })
    

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