title: swift ios add infinite scroll pagination to uitableview
body: <p>I wonder if tableview has any built-in function to add infinite scroll/pagination.</p>
  
  <p>Right now my VC looks like this:</p>
  
  <pre><code>var data: JSON! = []
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      //Init start height of cell
      self.tableView.estimatedRowHeight = 122
      self.tableView.rowHeight = UITableViewAutomaticDimension
  
      self.tableView.delegate = self
      self.tableView.dataSource = self
  
      savedLoader.startAnimation()
      //Load first page
      loadSaved(1)
  
  }
  
  func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
      return data.count
  }
  
  func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
  
      let cell = tableView.dequeueReusableCellWithIdentifier("aCell") as! SavedTableViewCell
  
      let info = data[indexPath.row]
      cell.configureWithData(info)
  
      return cell
  }
  
  func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
      performSegueWithIdentifier("WebSegue", sender: indexPath)
  
      tableView.deselectRowAtIndexPath(indexPath, animated: false)
  }
  </code></pre>
  
  <p>I fetch my data using <strong>loadSaved(1)</strong> by giving the function the current page I want to load. The function makes a API request using alomofire then populate the <strong>var data: JSON! = []</strong> with the data that should be displayed</p>
  
  <p>So what I want to do is when I scroll to the bottom of the tableview <strong>loadSaved(2)</strong> should be called loading more data into the tableview</p>