title: TableView loading more cell when scroll to bottom
body: <p>I created a tableView and when user scroll to the last cell more data will be loaded. In willDisplayCell I implemented this code, referenced from similar questions in stack overflow. But when I scroll to the bottom, it is not loading data once, it creates a loop and calls loadMore function more than once.</p>
  
  <pre><code>func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
      let lastData = self.data!.count - 1
      if indexPath.row == lastData {
          currentPage += 1
          self.loadData(currentPage)
      }
  }
  
  func loadData() {
      self.showLoadingView() 
      apiCALL(callback: { data
        self.jsonDATA.append(contentsOf: data)
        self.tableView.reloadData()
      })
  }
  </code></pre>