---
title: updateConstraintsIfNeeded()
framework: appkit
role: symbol
role_heading: Instance Method
path: appkit/nswindow/updateconstraintsifneeded()
---

# updateConstraintsIfNeeded()

Updates the constraints based on changes to views in the window since the last layout.

## Declaration

```swift
func updateConstraintsIfNeeded()
```

## Discussion

Discussion When a new layout pass is triggered for a window, the system invokes this method to ensure that any constraints for views in the window are updated with information from the current view hierarchy and its constraints. This method is called automatically by the system, but may be invoked manually if you need to examine the most up to date constraints. Subclasses should not override this method.

## See Also

### Triggering Constraint-Based Layout

- [layoutIfNeeded()](appkit/nswindow/layoutifneeded().md)
