UIView keep disappearing when changing constrain multiplier

hi, I have a small UIView box inside a larger box that's constrained to the superview(view). when I try to change the leading edges of the smaller box (referencing the trailing constrained to the larger box) it will disappear or fly off the screen, upon further investigation, I find that the constrain being changed is the top constrain of the smaller box... it's quite peculiar, the larger box uses essentially the same code and works as expected. The only difference I can think of is the larger box references to the edge "view" which Is fixed but not sure if that's what's causing the problem.

here is the code.

@IBAction func PinchOutlet(_ sender: UIPinchGestureRecognizer) {
       
        let newalphaLeadingConstrain = alphaLeadingConstrain.constraintWithMultiplier(alphaLeadingMultiplier)
        self.alphaLeadingConstrain = newalphaLeadingConstrain
        view.removeConstraint(self.alphaLeadingConstrain)
        view.addConstraint(newalphaLeadingConstrain)
        if sender.scale>1{
            self.alphaLeadingMultiplier = 0.1
        }
        else{
            self.alphaLeadingMultiplier = 0.5
        }
        self.view.layoutIfNeeded()

    }

Why do you set self.alphaLeadingMultiplier after using it ?

What is the value of self.alphaLeadingMultiplier at start ?

Please instrument and tell what you get:

@IBAction func PinchOutlet(_ sender: UIPinchGestureRecognizer) {
       
        print("alphaLeadingMultiplier", self.alphaLeadingMultiplier)  // <<-- ADD THIS

        let newalphaLeadingConstrain = alphaLeadingConstrain.constraintWithMultiplier(alphaLeadingMultiplier)
        self.alphaLeadingConstrain = newalphaLeadingConstrain
        view.removeConstraint(self.alphaLeadingConstrain)
        view.addConstraint(newalphaLeadingConstrain)
        if sender.scale>1{
            self.alphaLeadingMultiplier = 0.1
        }
        else{
            self.alphaLeadingMultiplier = 0.5
        }
        self.view.layoutIfNeeded()

    }
UIView keep disappearing when changing constrain multiplier
 
 
Q