First thing is constraints. You must have proper constraints with UIScrollView
and container's view
Next thing you need is height constraints of tableviewController
(you can give height to 0 with relation greater than equal with 750 priority so constrains would never break if something wrong happened)
Take IBOutlet of that height constraint when your data insert / delete happen your content size will change and apply that contentsize height to constant of IBOutlet constraint and don't forgot to layoutIfNeeded.
Make your tableview scrolling bounce to false
create protocol
to notify container view about height change
protocol ContainerTableDelegate {
func dataChanged(height: CGFloat)
}
and when height change notify parent view controller
delegate?.dataChanged(self.heightConstraint.constant)
Now in the main viewcontroller where you have all containers
implement
override func prepare(for segue: UIStoryboardSegue, sender: Any?)
identify ViewController set delegate to self
implement delegate and change height of container view 3 constant (You also need this)
Hope it will help to solve your issue