title: UITableViewCell with a StackView inside with dynamically added WKWebViews and UIImageViews
body: <p>As the title says, I'm trying to display the following layout:</p>
  <p><a href="https://i.stack.imgur.com/Mso6t.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Mso6t.png" alt="I'm not able to indent because of that I did a screenshot" /></a></p>
  <p>As you see, the dynamic stack view is a container where content is added dynamically. This content is variable and is decided on run time. Basically, it can be webviews (with variable content inside), ImageViews (with variable height), and videos (this view would have a fixed view).</p>
  <p>I configured the CellView with automatic row height, and provided an estimated row height, both in code and in Xcode. Then on the tableView_cellForRow at the method of the ViewController, the cell is dequeued and the cell is rendered with content.</p>
  <p>During this setup process, the different labels and views are filled with content, and the dynamic container too. The webviews are added to the stackview with the following code:</p>
  <pre><code>    var webView = WKWebView(frame: .zero, configuration: webConfiguration)
      webView.scrollView.isScrollEnabled = false
      webView.navigationDelegate = myNavigationDelegate
  
      webView = addContentToWebView(content, webView)
      container.addArrangedSubview(webView)
  </code></pre>
  <p>I'm testing this with only a webview inside the stackview and having already problems with the height of the row.</p>
  <p>The webview is rendered correctly inside the stackview, but not completely (the webview was bigger as the estimated rowheight). I used the navigation delegate to calculate the height of the added webview and resize the StackContainer accordingly, with the following code:</p>
  <pre><code>  webView.evaluateJavaScript(&quot;document.readyState&quot;, completionHandler: { (complete, error) in
          if complete != nil {
              webView.evaluateJavaScript(&quot;document.body.scrollHeight&quot;, completionHandler: { (height, error) in
                 
                  let h = height as! CGFloat
                  print(&quot;Height 3 is \(h)&quot;)
                  self.dynamicContainerHeightContraint.constant = h
  
              })
          }
          
      })
  </code></pre>
  <p>And indeed, the stackcontainer is resized and expanded to match the height of the webview that is inside.</p>
  <p>But the row remains with the same estimated height, and if the webview is very big in height, then all the other views disappear (they are pushed outside the bounds of the row.</p>
  <p>Is there a way to tell the row to autoresize and adapt to its contents? Or maybe I'm using the false approach?</p>
  <p>I suppose the problem is that the height of the views added to the stackview is not known in advance, but I was expecting a way to tell the row to recalculate its height after adding all the needed stuff inside...</p>
  <p>Thank you in advance.</p>