title: How to wrap long text correctly?
body: <p>In my application users can post comments on posts. Everything works fine however the lines do not wrap when creating a long text thus I get this</p>
  
  <p><a href="https://i.stack.imgur.com/KkG7u.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KkG7u.png" alt="enter image description here"></a></p>
  
  <p><code>numberOfLines</code> is set to = 0 </p>
  
  <p>Here is the code in the <code>commentCell</code> setting the constraints </p>
  
  <pre class="lang-swift prettyprint-override"><code>
     let commentLabel: ActiveLabel = {
              let label = ActiveLabel()
              label.font = UIFont.systemFont(ofSize: 13)
              label.numberOfLines = 0
  
              return label
              }()
  
  </code></pre>
  
  <pre class="lang-swift prettyprint-override"><code>  override init(frame: CGRect) {
              super.init(frame: frame)
  
  
  
              addSubview(profileImageView)
              profileImageView.anchor(top: topAnchor, left: leftAnchor, bottom: nil, right: nil, paddingTop: 8, paddingLeft: 8, paddingBottom: 0, paddingRight: 0, width: 40, height: 40)
              profileImageView.layer.cornerRadius = 40 / 2
  
  
              addSubview(optionsButton)
              optionsButton.anchor(top: topAnchor, left: nil, bottom: nil, right: rightAnchor, paddingTop: 12, paddingLeft: 0, paddingBottom: 0, paddingRight: 8, width: 20, height: 20)
  
              addSubview(commentLabel)
              commentLabel.anchor(top: topAnchor, left: profileImageView.rightAnchor, bottom: bottomAnchor, right: optionsButton.leftAnchor, paddingTop: 15, paddingLeft: 5, paddingBottom: 15, paddingRight: 8, width: 0, height: 0)
  
              addSubview(commentTimeLabel)
          commentTimeLabel.anchor(top: commentLabel.bottomAnchor, left: commentLabel.leftAnchor, bottom: nil, right: nil, paddingTop: 3, paddingLeft: 1, paddingBottom: 0, paddingRight: 0, width: 0, height: 0)
  
  
  
              optionsButton.isEnabled = true
  
              optionsButton.isUserInteractionEnabled = true
  
              commentLabel.isUserInteractionEnabled = true
          }
  
          required init?(coder aDecoder: NSCoder) {
              fatalError("init(coder:) has not been implemented")
          }
  
  </code></pre>
  
  <p>And here is the CommentViewController code that should be resizing the cell for me but it doesn't. I've used this before in the past so I'm not sure if I am missing anything </p>
  
  <pre class="lang-swift prettyprint-override"><code>
     func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -&gt; CGSize {
  
  
             let frame = CGRect(x: 0, y: 0, width: view.frame.width, height: 50)
             let dummyCell = CommentCell(frame: frame)
             dummyCell.comment = comments[indexPath.item]
             dummyCell.layoutIfNeeded()
  
             let targetSize = CGSize(width: view.frame.width, height: 1000)
             let estimatedSize = dummyCell.systemLayoutSizeFitting(targetSize)
  
             let height = max(40 + 8 + 8, estimatedSize.height)
             return CGSize(width: view.frame.width, height: height)
      }
  
  
      func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -&gt; CGFloat {
          return 15
      }
  
  
  </code></pre>