Animations and layout code based constraints

I’m reading IOS programming 6th edition. Chapter 8 covers automation. I don’t understand how changing constraints outside of the closure which is passed to automate actually results in the layout constraints moving the labels below. Can you please explain that to me?

    let screenWidth = view.frame.width
    self.nextQuestionLabelCenterXConstraint.constant = 0
    self.currentQuestionLabelCenterXConstraint.constant += screenWidth
    
    UIView.animate(withDuration: 0.5,
        delay: 0,
        options: [.curveLinear],
        animations: {
            self.currentQuestionLabel.alpha = 0
            self.nextQuestionLabel.alpha = 1
            
            self.view.layoutIfNeeded()
        },