title: iOS tableview how can I check if it is scrolling up or down
body: <p>I am learning how to work with TableViews and I am wondering how can I figure out if the tableView is scrolling up or down ? I been trying various things such as this but it hasn't worked granted that below is for a scrollview and I have a TableView . Any suggestions would be great as I am new at this ...</p>
  
  <pre><code>  func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
      if scrollView.panGestureRecognizer.translation(in: scrollView).y &lt; 0 {
          print("down")
      } else {
          print("up")
      }
  }
  </code></pre>
  
  <p>This is what I have in my tableView code</p>
  
  <pre><code>func tableView(_ tableView:UITableView, numberOfRowsInSection section:Int) -&gt; Int {
          return Locations.count
      }
  
      func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
          if indexPath.row == self.Posts.count - 4 {
  
              reloadTable(latmin: self.latmin,latmax: self.latmax,lonmin: self.lonmin,lonmax: self.lonmax,my_id: myID)
              print("Load More")
          }
  
      }
  
  
      func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
          let cell = tableView.dequeueReusableCell(withIdentifier: "HomePageTVC", for: indexPath) as! NewCell
  
  
     cell.post.text = Posts[indexPath.row]
     cell.fullname.setTitle(FullName[indexPath.row],for: UIControlState.normal)
  
          return cell
      }
  </code></pre>