---
title: updateConstraintsForSubtreeIfNeeded()
framework: appkit
role: symbol
role_heading: Instance Method
path: appkit/nsview/updateconstraintsforsubtreeifneeded()
---

# updateConstraintsForSubtreeIfNeeded()

Updates the constraints for the receiving view and its subviews.

## Declaration

```swift
func updateConstraintsForSubtreeIfNeeded()
```

## Discussion

Discussion Whenever a new layout pass is triggered for a view, the system invokes this method to ensure that any constraints for the view and its subviews 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 Auto Layout

- [needsLayout](appkit/nsview/needslayout.md)
- [layout()](appkit/nsview/layout().md)
- [layoutSubtreeIfNeeded()](appkit/nsview/layoutsubtreeifneeded().md)
- [needsUpdateConstraints](appkit/nsview/needsupdateconstraints.md)
- [updateConstraints()](appkit/nsview/updateconstraints().md)
