title: UICollectionViewCell with AutoLayout not working in iOS 10
body: <p>I'm trying to create a dynamic UICollectionView whose cells auto-resize based on the text inside it. But for some reasons, my custom UICollectionViewCell won't expand to the full width. I am using <a href="http://snapkit.io/docs/" rel="nofollow noreferrer">SnapKit</a> as AutoLayout and all my views are code-based; no xib or storyboard. Here's a debug view of what I got at the moment:</p>
  
  <p><a href="https://i.stack.imgur.com/mzIYMm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mzIYMm.png" alt="enter image description here"></a></p>
  
  <p>I want the cell to expand full width and the height to fit whatever the content is. Here's a snippet on my <strong>UICollectionViewController</strong></p>
  
  <pre><code>override func viewDidLoad() {
      super.viewDidLoad()
  
      self.title = "Home"
  
      let layout = UICollectionViewFlowLayout()
      layout.itemSize = CGSize(width: view.frame.width, height: view.frame.height)
      layout.scrollDirection = .vertical
      layout.estimatedItemSize = CGSize(width: 375, height: 250)
  
      collectionView = UICollectionView(frame: CGRect(x: 0, y: 0, width: view.frame.width, height: view.frame.height), collectionViewLayout: layout)
      collectionView.dataSource = self
      collectionView.delegate = self
      collectionView.backgroundColor = UIColor(red: 245/255, green: 245/255, blue: 245/255, alpha: 1)
      collectionView.register(HomeCollectionViewCell.self, forCellWithReuseIdentifier: reuseIdentifier)
  
  
      self.view.addSubview(collectionView)
  
  }
  
  func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -&gt; UICollectionViewCell {
      let cell = collectionView.dequeueReusableCell(withReuseIdentifier: reuseIdentifier, for: indexPath)
  
      // Configure the cell
      if let c = cell as? HomeCollectionViewCell {
          c.contentView.frame = c.bounds
          c.contentView.autoresizingMask = [.flexibleHeight, .flexibleWidth]
          configureCell(c, indexPath: indexPath)
  
      }
  
      return cell
  }
  
  func configureCell(_ cell: HomeCollectionViewCell, indexPath: IndexPath) {
      cell.setText(withTitle: items[(indexPath as NSIndexPath).section].title)
  }
  </code></pre>
  
  <p>And here's a snippet of my custom <strong>UICollectionViewCell</strong></p>
  
  <pre><code>override init(frame: CGRect) {
      super.init(frame: frame)
  
      self.contentView.autoresizingMask = [.flexibleHeight, .flexibleWidth]
      self.contentView.translatesAutoresizingMaskIntoConstraints = true
      self.contentView.bounds = CGRect(x: 0, y: 0, width: 99999, height: 99999)
  
      createTitle()
  
  }
  
  private func createTitle() {
      titleView = TTTAttributedLabel(frame: CGRect(x: 0, y: 0, width: contentView.frame.width, height: 56))
      titleView.tag = 1
      titleView.numberOfLines = 2
      titleView.delegate = self
      titleView.translatesAutoresizingMaskIntoConstraints = false
  
      contentView.addSubview(titleView)
  
      titleView.snp_updateConstraints(closure: {
          make in
  
          make.leading.trailing.equalTo(contentView).offset(10)
          make.top.equalTo(contentView).offset(10)
          make.bottom.equalTo(contentView).offset(-10)
  
      })
  }
  
  func setText(withTitle title:String, paragraph: String, image: String) {
      let titleAttributed = AttributedString(string: title, attributes: titleStringAttr)
  
      titleView.attributedText = titleAttributed
      titleView.sizeToFit()
  }
  </code></pre>
  
  <p>I've spent 3 days just working on this on and on.. Any advice appreciated!</p>