title: Custom collection view cell not working properly
body: <p>Trying to create a custom cell but when I am adding label in the cell <code>collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath)</code> doesn't work.</p>
  
  <p>Without label cell UI:</p>
  
  <p><a href="https://i.stack.imgur.com/ch9Ij.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ch9Ij.png" alt="enter image description here"></a></p>
  
  <p>and the iPad simulator UI is: </p>
  
  <p><a href="https://i.stack.imgur.com/GIVz9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GIVz9.png" alt="enter image description here"></a></p>
  
  <p>But when I am adding label into the cell:</p>
  
  <p><a href="https://i.stack.imgur.com/rr3HQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rr3HQ.png" alt="enter image description here"></a></p>
  
  <p>The iPad Simulator UI becomes :</p>
  
  <p><a href="https://i.stack.imgur.com/N6zaT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/N6zaT.png" alt="enter image description here"></a></p>
  
  <p>In <code>UICollectionViewDelegateFlowLayout</code> in the method:</p>
  
  <pre><code>func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -&gt; CGSize {
      let emptySpace = 87*2 + 10
      let remainingWidth = Int(self.view.frame.width) - emptySpace
      return CGSize(width: remainingWidth/2, height: remainingWidth/2)
  }
  </code></pre>