Contents

needsUpdateConstraints

A Boolean value indicating whether the view’s constraints need to be updated.

Declaration

var needsUpdateConstraints: Bool { get set }

Discussion

When a property of your view changes in a way that would impact constraints, set the value of this property to true to indicate that the constraints need to be updated at some point in the future. The next time the layout process happens, the constraint-based layout system uses the value of this property to determine whether it needs to call updateConstraints() on the view. Use this as an optimization tool to batch constraint changes. Updating constraints all at once just before they are needed ensures that you don’t needlessly recalculate constraints when multiple changes are made to your view in between layout passes.

See Also

Triggering Auto Layout