title: Firebase Pagination - Swift & iOS. When should it be used?
body: <p>I have a database that holds <code>Posts</code>. At a future point, my database may hold a very large number of <code>Posts</code>. I am confused as to what to do, as I cannot decide between the few options that I've thought of so far:</p>
  
  <p>1) Load all <code>Posts</code> at once and store them into an <code>Posts[]</code> array, and just show all posts on the <code>TableView</code> that displays them. </p>
  
  <p>2) Load 10 <code>Posts</code> at once and display those 10 at a time, then implement a function that allows the user to scroll and to load 10 more at a time. These 10 values that are loaded will then be added to the <code>TableView</code>. </p>
  
  <p>Now, option #1 seems simple and attractive, as it is what I  currently have set up. However, I am not sure if it would be problematic or not to constantly load hundreds of posts every time a user opens the page that displays <code>Posts</code>. </p>
  
  <p>Option #2 seems complex, as I have no idea how to only load 10 <code>Posts</code> at once using Firebase. I am using a <code>.childAdded</code> observation to gather the data, and that usually loads all of the <code>Posts</code>. An alternative idea I had that may or may not be useless is loading all <code>Posts</code> into the <code>Posts[]</code> array but only displaying 10 at a time. This option is attractive because users won't have to load every single post every time they view the <code>TableView</code> that contains the posts. I am also hesitant to take this option because I would have to alter my data structure quite a lot. The current set up is:</p>
  
  <p><code>root/posts/post-id/post-info</code></p>
  
  <p>In which the post-info node holds information relevant to the post, and does not contain an index, which I have a feeling that option #2 would require. </p>
  
  <p>I'm quite stuck here. What's the best action to take in a situation like this?</p>