title: UICollectionView dynamically resize height to display all content without scrolling
body: <p>I would like to dynamically resize UICollectionView height and display all cells without scrolling when page loads. </p>
  
  <p>I tried following codes in viewDidLoad but didn't work</p>
  
  <pre><code>self.constraintTableViewHeight.constant = self.myProfileCollectionView.contentSize.height
  </code></pre>
  
  <p>or</p>
  
  <pre><code>self.constraintTableViewHeight.constant = self.myProfileCollectionView.collectionViewLayout.collectionViewContentSize().height
  </code></pre>