I am trying to make a simple animation using constraints. When the button is pressed, the following occurs:
I created two variables for height and boolean
var isCollectionOpen = false
var collectionHeightConstraint = NSLayoutConstraint()
Set limits for the entire user interface through code and in the same place brought the height of the collection to a variable
// ...
btcView.collectionView.heightAnchor.constraint(equalToConstant: collectionHeightConstraint.constant),
// ...
And I'm trying to change the constraints on pressing the button. But nothing happens. What is my problem?
func example() {
collectionHeightConstraint.constant = isCollectionOpen ? (view.frame.width / 4) : 0
isCollectionOpen = !isCollectionOpen
}

