If I have this for a child view controller:
autoCompleteViewController.view.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.act
First you have disable the previous constraint and activate another
For example
let heightAnchor_one = autoCompleteViewController.view.heightAnchor.constraint(equalToConstant: x)
let heightAnchor_two = autoCompleteViewController.view.heightAnchor.constraint(equalToConstant: y)
heightAnchor_one.isActive = true
heightAnchor_two.isActive = false
then whichever constraint you need activate that and disable the other.