title: Nested UITableView dynamic height
body: <p>I need to have a nested UITableView in a tableView cell (actually, two tables in one cell) to show different lists with dynamic content (so, I need dynamic heights). My nested tables will not have scrolling—I need them just to order elements of different kinds, like texts, pictures, fields etc. To be more clear—the first level is the level of operations and every operation can have a variable amount of instructions and actions. Instructions and actions should be placed side by side and the operation cell should have the size of the tallest table.</p>
  
  <p>There are no problems in nesting tables, but I faced a problem with the auto layout. I’ve tried everything that I could find, but with no success.</p>
  
  <p>I tried height constraints for nested table views, which I update on the operation cell creation from tableview.contentsize.hight, but it seems that contentsize returns height based on the estimated size of every row, but not the actual size.</p>
  
  <p>I tried to rewrite intrinsic content size of nested tables:</p>
  
  <pre><code>UITableView {
  
      override var contentSize:CGSize {
          didSet {
              self.invalidateIntrinsicContentSize()
          }
      }
  
      override var intrinsicContentSize: CGSize {
          self.layoutIfNeeded()
          return CGSize(width: UIViewNoIntrinsicMetric, height: contentSize.height)
      }
  }
  </code></pre>
  
  <p>Nothing works properly. Any ideas how it could be solved?</p>
  
  <p>Thank you in advance. </p>