title: How to give a collection view section header dynamic height
body: <p>I have a collection view with a section header that displays a users information. The header can include a bio from the user. I am having trouble with resizing the header if the bio is long. The label will not display the whole bio because the header stays at a fixed height. </p>
  
  <p>I created the collection view via storyboard however I added the constraints programmatically.</p>
  
  <p>Here is the bio constraints, I thought by setting the height and lines to 0 I would be okay,</p>
  
  <pre class="lang-swift prettyprint-override"><code>      addSubview(bioLabel)
          bioLabel.anchor(top: editProfileButton.bottomAnchor, left: leftAnchor, bottom: nil, right: rightAnchor, paddingTop: 12, paddingLeft: 12, paddingBottom: 0, paddingRight: 12, width: 0, height: 0)
  </code></pre>
  
  <p>I also thought I could override the storyboard by</p>
  
  <pre><code>
      // Trying to override storyboard header height so the header can strech depending on the bio height
      func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -&gt; CGSize {
  
          //TODO change height to be bounds.height of bioLabel?
          return .init(width: view.frame.width, height: 300)
  
      }
  </code></pre>
  
  <p>but it appears even if I try to change the size through code, it keeps the  storyboard height of 225 ( which is what I would like) </p>