title: How to give explicit size to UIImage inside of a UIStackView with padding?
body: <h2>TL;DR</h2>
  <ol>
  <li>How do you add padding <em>inside</em> a <code>UIStackView</code>, kind of like how we add padding for <code>SwiftUI</code> <code>HStack</code>s?</li>
  <li>How do you use a <code>UIImageView</code> with explicit height inside of a <code>UIStackView</code>?</li>
  </ol>
  <h2>Context</h2>
  <p>I have the following scenario:</p>
  <p>A <code>containerView</code> that is pinned to the <code>contentView</code> of a <code>UITableViewCell</code>. The <code>containerView</code> is responsible for showing rounded corners and having a <code>backgroundColor</code>.</p>
  <p>The <code>containerView</code> has a horizontal <code>stackView</code> as a subview. The <code>stackView</code> has a <code>UIImageView</code> and a <code>Label</code>.</p>
  <p>The <code>stackView</code> needs to be padded by 8 px on all sides.</p>
  <p>The <code>imageView</code> has to be <code>18 x 18</code> - <em>This is what's giving constraint issues in the debugger, and is the constraint that autolayout suggests to break</em>.</p>
  <p>My assumption is that autolayout is saying - &quot;You want the <code>stackView</code> to be the height of its content, <em>plus</em> 8 px padding, but the <code>imageView</code> also has an explicit size - what if there's not enough room to make the <code>imageView</code> that size?</p>
  <h2>Code</h2>
  <p>Here's the <code>iconImageView</code>:</p>
  <pre><code>    private let iconImageView: UIImageView = {
          let imageView = UIImageView()
          imageView.translatesAutoresizingMaskIntoConstraints = false
          imageView.adjustsImageSizeForAccessibilityContentSizeCategory = true
          imageView.constrainedSize = CGSize(width: iconSize, height: iconSize)
          imageView.image = UIImage(image: image)
          imageView.tintColor = .color
          return imageView
  }()
  </code></pre>
  <p>Here's the layout code:</p>
  <pre><code>    private func setupView() {
          contentView.addSubview(containerView)
          contentView.pinView(containerView, positions: .all, insets: UIEdgeInsets(top: 0, left: 0, bottom: 4, right: 0))
      
          stackView.addArrangedSubview(iconImageView)
          stackView.addArrangedSubview(messageLabel)
      
          containerView.addSubview(stackView)
          containerView.pinView(stackView, positions: .all, insets: UIEdgeInsets(top: 8, left: 8, bottom: 8, right: 8))
  }
  </code></pre>
  <h2>What I've Tried</h2>
  <ul>
  <li>Rearranging the contraints</li>
  <li>Giving the <code>stackView</code> an explicit height</li>
  <li>Giving the <code>stackView</code> a <code>constraintGreaterThanOrEqualTo</code> constraint</li>
  </ul>