title: How to make a collapsible header in collectionView as same as Facebook header?
body: <p>Guys I need to make a collectionView header and it should work as when I scroll up the header collapses till specific point then the collapsing stops and the scroller keep scrolling as before collapsing,
  you can check this behavior in Facebook android app yet, I need to implement the same thing in iOS using swift,
  I have already tried to do so by using the delegate method of collectionView which is "scrollViewDidScroll" and this was myCode </p>
  
  <pre><code>func scrollViewDidScroll(_ scrollView: UIScrollView) {
       let layout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout
          if scrollView.contentOffset.y &gt; 199 {
              headerHeight = 101
              layout?.sectionHeadersPinToVisibleBounds = true
              collectionView.reloadData()
          } else if scrollView.contentOffset.y &lt; 199 {
              headerHeight = 300
              layout?.sectionHeadersPinToVisibleBounds = false
              collectionView.reloadData()
  
          }
      }
  </code></pre>
  
  <p>PS: my original header height is 300, and the 199 is the portion which I need to hide after scrolling and the 101 value is the desired header height after scrolling </p>
  
  <p>When I implemented this snippet of code , everything works fine but the problem is that when I reach the contentoffset.y of 199 , the cells of the collectionView will move up a little and when I scroll down &lt; 199 the cells moves down , this quick move happens instantly, not smoothly which is bad UX. How to solve such a bug please?</p>