Beginning iOS Animations · Animating Constraint Multipliers |

This is a companion discussion topic for the original entry at


What purpose does the return serve in the forEach() closure of the titleLabel.superView.constraints if it doesn’t break out of the loop once reached?

1 Like

Hi! Thanks for asking. I can see why that would be confusing.

I expect those two if statement conditions to be mutually exclusive. So the return is there because I wouldn’t want to bother to check the second condition if the first were true, but I would want to continue the loop.

It probably would have been much more clear to use an else if for that second condition, or even use a for loop instead of forEach.