title: TableView willDisplayCell called for cells that are not on the screen (tableView pagination)
body: <p>I use <a href="https://stackoverflow.com/a/35475282/5969121">the idea of custom TableView pagination</a> using willDisplayCell (or cellForRowAt) and updates from the server.</p>
  
  <p>And the problem is that willDisplay called even for cells that are not on the screen.</p>
  
  <p>How can I handle this behavior and change the flow to update cells only when user get scrolled to the last cell?</p>
  
  <pre><code>private func isLoadingIndexPath(_ indexPath: IndexPath) -&gt; Bool {
      return indexPath.row == self.orders.count - 1
  }
  
  override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
      // fetch new data if user scroll to the last cell
      guard isLoadingIndexPath(indexPath) else { return }
      if self.totalItems &gt; orders.count {
          fetchNextPage()
      }
  }
  
  private func fetchNextPage() {
      self.currentPage += 1
      self.delegate?.didReachLastCell(page: currentPage)
  }
  </code></pre>
  
  <p>didReachLastCell calls the addOrders:</p>
  
  <pre><code>func addOrders(_ orders: [OrderView]) {
      self.orders.append(contentsOf: orders)
      reloadOrders()
  }
  
  fileprivate func reloadOrders() {
      self.tableView.reloadData()
  }
  </code></pre>
  
  <p><strong>Note:</strong> The same problem is reproducible for cellForRowAt method too.</p>