I have a viewController and I want to have two 1 tableView and 1 childViewController inside it.
I suggest subclassing UITableView
like this:
class AutomaticHeightTableView: UITableView {
override var intrinsicContentSize: CGSize {
return contentSize
}
override func reloadData() {
super.reloadData()
invalidateIntrinsicContentSize()
}
}
Then in Interface Builder set AutomaticHeightTableView
as the class to your table view and the table will try to size itself to fit the content. It will follow any other constraints you placed so make sure the constraints allow it to grow freely.