If I have this for a child view controller:
autoCompleteViewController.view.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.act
I've fixed it by implementing it like this:
autoCompleteViewControllerHeight = NSLayoutConstraint(
item: autoCompleteViewController.view,
attribute: .height,
relatedBy: .equal,
toItem: nil,
attribute: .height,
multiplier: 1.0,
constant: 44.0)
guard let autoCompleteViewControllerHeight = autoCompleteViewControllerHeight else { return }
autoCompleteViewControllerHeight.isActive = true
and then where it should be changed I added:
let newHeight = calculateNewHeight()
heightConstraintAutoCompleteViewController.constant = newHeight
It works like a charm.