Pull-to-Refresh to load old comments using Firebase

Firstly I want to load last 10 comments about a post, but If user go top of the tableView and then pull to refresh I wanna load before 10 comment more.

How Can It be possible, If someone explain It would be great.

hi @bgunduz,
Hope you have found the solution to this, if not here’s an attempt to help you understand.

What you are requesting in some ways is called infinite scrolling, and generally implemented in a way that when you reach the last item of the list, another batch of n is loaded and it goes on.

If you had a button called load 10 more, say instead of our pull to refresh, how would you achieve that? You would query and load 10 more items from the db into your memory structure that drives the tableview.

So now instead of the button responding to that function, call the function when you pull to refresh.

cheers,