title: How to add fixed size UIView to UIStackView?
body: <p>On the latest Xcode (10.1), I'm having trouble adding a fixed size UIView to my UIStackView using programmatic constraints. I think this should be straightforward, but I don't understand where extra constraints are coming from (that UIKit has to break some to layout the views).</p>
  
  <p>The problem is that I am expecting a blue UIView of 100x100. The reality is that the blue UIView is 100% screen width &amp; 100% screen height.</p>
  
  <p>I realize UIStackView uses <code>intrinsicContentSize</code>, but how do I set that correctly using programmatic constraints?</p>
  
  <p>The following is a working playground with an UIStackView &amp; a vanilla UIView added.</p>
  
  <p>Note: if I add the blue UIView directly to the ViewController's <code>view</code>, the size is correct at 100x100 at origin (0,0). Adding it to the stack view causes constraint conflicts.</p>
  
  <pre><code>import UIKit
  import PlaygroundSupport
  
  class MyViewController : UIViewController {
  
      override func loadView() {
          let view = UIView()
          view.backgroundColor = .white
          self.view = view
  
          // vertical stack view (full screen)
          let stackView = UIStackView()
          stackView.translatesAutoresizingMaskIntoConstraints = false
          stackView.axis = .vertical
          view.addSubview(stackView)
  
          NSLayoutConstraint.activate([
              stackView.topAnchor.constraint(equalTo: view.topAnchor),
              stackView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
              stackView.centerXAnchor.constraint(equalTo: view.centerXAnchor),
              stackView.widthAnchor.constraint(equalTo: view.widthAnchor),
              ])
  
          // view (100x100)
          let fixedSizeView = UIView()
          fixedSizeView.translatesAutoresizingMaskIntoConstraints = false
          fixedSizeView.backgroundColor = .blue
  
          stackView.addArrangedSubview(fixedSizeView)
  
          NSLayoutConstraint.activate([
              fixedSizeView.widthAnchor.constraint(equalToConstant: 100),
              fixedSizeView.heightAnchor.constraint(equalToConstant: 100),
              ])
      }
  }
  // Present the view controller in the Live View window
  PlaygroundPage.current.liveView = MyViewController()
  
  </code></pre>