I set up width of UIView like this:
contentView.widthAnchor.constraint(equalToConstant: CGFloat(scrollWidth())).isActive = true
Now I want to change that width. The question is: how to remove old constraint and add new? I did create NSLayoutConstraint like this
scrollWidthConstraint = NSLayoutConstraint(
item: contentView,
attribute: .width,
relatedBy: .equal,
toItem: nil,
attribute: .notAnAttribute,
multiplier: 1.0,
constant: CGFloat(scrollWidth())
)
How to set that constraint for UIView for changing later?