How to partition an endless feed? (for example reddit, twitter, facebook, youtube comments...)

My problem is that in an “endless” feed, there can be thousands upon thousands of elements. The client obviously shouldn’t (and doesn’t in apps like Twitter) download them all at once. Only small chunks get downloaded, like 30 elements, and then, IF the user scrolls far enough down, the next chunk loads.

How could I achieve this functionality in realm? It is also very important to keep in mind the steady growing of new elements that get added to the server, so just making like a partition-1 for the first 30 elements, partition-2, partition-3 and so one will not work (or does it?).

This is such a common theme I think there clearly has to be some kind of solution. I also haven’t really looked into flexible syncing, maybe that’s the solution? Excited to read your comments.