title: How to prevent UICollectionView to overlap
body: <p>I have this problem when I created too many folders into my app.</p>
  
  <p>The folders overlap on other UI elements </p>
  
  <p><a href="https://i.stack.imgur.com/4F0is.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4F0is.png" alt="This is the normal view"></a></p>
  
  <p>If instead, I scroll this what happened </p>
  
  <p><a href="https://i.stack.imgur.com/ThHmg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ThHmg.png" alt="enter image description here"></a></p>
  
  <p>I need to stop the scroll and not overlap the other elements</p>
  
  <p>This is my code</p>
  
  <pre><code> func collectionView(_: UICollectionView, layout _: UICollectionViewLayout, insetForSectionAt _: Int) -&gt; UIEdgeInsets {
      return UIEdgeInsets(top: 0.0, left: 10.0, bottom: 0.0, right: 10.0)
  }
  
  func collectionView(_: UICollectionView, layout _: UICollectionViewLayout, minimumLineSpacingForSectionAt _: Int) -&gt; CGFloat {
      return 10.0
  }
  
  func collectionView(_: UICollectionView, layout _: UICollectionViewLayout, sizeForItemAt _: IndexPath) -&gt; CGSize {
      return CGSize(width: UIScreen.main.bounds.size.width, height: 70)
  }
  
  func collectionView(_: UICollectionView, numberOfItemsInSection _: Int) -&gt; Int {
      return arrItems.count
  }
  </code></pre>
  
  <p>The Constrains</p>
  
  <p><a href="https://i.stack.imgur.com/15VCB.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/15VCB.jpg" alt="enter image description here"></a> </p>
  
  <p>You can see my constraints to the left</p>
  
  <p>Thanks In advance </p>