title: Pagination with Alamofire and realm.io
body: <p>I have an api which could look like <code>http://URL/news/:lastloaded/:size</code> where <code>lastloaded</code>and <code>size</code> is the range of objects the api should return. This api returns a list of different news, which i want to show in a tableView. However in order to make it effective i wan't to make some kind of pagination, so that not all objects is loaded into the tableView. This i've achieved through simple variables like</p>
  
  <pre><code>let pageSize = 20
  var lastLoadedPage = 0
  </code></pre>
  
  <p>however how do i make sure that the database in my case realm.io always is up to date with all the news from the api. I can easily change the api and add more parameters if it makes this easier? What is best practice? i'm using <a href="https://github.com/Alamofire/Alamofire" rel="nofollow">Alamofire</a> and <a href="https://realm.io/docs/swift/latest/" rel="nofollow">realm.io</a></p>