title: Swift Change Xib Height Programmatically
body: <p>I implemented 2 Xib file to View Controller (1 View , 1 CollectionView). I want to show/hide the view when scrolling. I can hide view (set height:0) , but when I want to get back (set height:50) , it's not working.</p>
  
  <p>Thanks in advance.</p>
  
  <pre><code>func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer&lt;CGPoint&gt;) {
  
      if scrollView.panGestureRecognizer.translation(in: scrollView).y &lt; 0{
  
          self.searchFieldView.heightAnchor.constraint(equalToConstant: 0).isActive = true
          self.searchFieldView.clipsToBounds = true
          //self.view.setNeedsLayout()
          self.view.layoutIfNeeded()
      }
      else{
  
          self.searchFieldView.heightAnchor.constraint(equalToConstant: 50).isActive = true
          //self.view.setNeedsLayout()
          self.view.layoutIfNeeded()
      }
  
  }
  </code></pre>