title: Hide tab bar when tableview scroll in swift 4
body: <p>I have view controller with tableview when i scroll tableview i want to hide tab bar in view controller. i have tried below code its working but top label went minus position of origin Y</p>
  
  <pre><code>extension UITabBarController {
      func setTabBarVisible(visible:Bool, duration: TimeInterval, animated:Bool) {
      if (tabBarIsVisible() == visible) { return }
      let frame = self.tabBar.frame
      let height = frame.size.height
      let offsetY = (visible ? -height : height)
  
      // animation
      if #available(iOS 10.0, *) {
          UIViewPropertyAnimator(duration: duration, curve: .linear) {
              self.tabBar.frame.offsetBy(dx:0, dy:offsetY)
              self.view.frame = CGRect(x:0,y:0,width: self.view.frame.width, height: self.view.frame.height + offsetY)
              self.view.setNeedsDisplay()
              self.view.layoutIfNeeded()
              }.startAnimation()
      } else {
          // Fallback on earlier versions
      }
  }
  
  func tabBarIsVisible() -&gt;Bool {
      return self.tabBar.frame.origin.y &lt; UIScreen.main.bounds.height
  }
  }
  
  //Scroll view delegate method
  func scrollViewDidScroll(_ scrollView: UIScrollView) {
      if scrollView.panGestureRecognizer.translation(in: scrollView).y &lt; 0{
          //scrolling down
          self.tabBarController?.setTabBarVisible(visible: false, duration: 0.3, animated: true)
      }
      else{
          //scrolling up
          self.tabBarController?.setTabBarVisible(visible: true, duration: 0.3, animated: true)
      }
  }
  </code></pre>
  
  <p>Here its video link
      <a href="https://drive.google.com/file/d/1yNc_mYNySFEd5XLxYn6PG4uizBu82hIp/view" rel="nofollow noreferrer">https://drive.google.com/file/d/1yNc_mYNySFEd5XLxYn6PG4uizBu82hIp/view</a></p>
  
  <p>Thank you</p>