---
title: layoutIfNeeded()
framework: uikit
role: symbol
role_heading: Instance Method
path: uikit/uiview/layoutifneeded()
---

# layoutIfNeeded()

Lays out the subviews immediately, if layout updates are pending.

## Declaration

```swift
func layoutIfNeeded()
```

## Discussion

Discussion Use this method to force the view to update its layout immediately. When using Auto Layout, the layout engine updates the position of views as needed to satisfy changes in constraints. Using the view that receives the message as the root view, this method lays out the view subtree starting at the root.  If no layout updates are pending, this method exits without modifying the layout or calling any layout-related callbacks.

## See Also

### Laying out subviews

- [layoutSubviews()](uikit/uiview/layoutsubviews().md)
- [setNeedsLayout()](uikit/uiview/setneedslayout().md)
- [requiresConstraintBasedLayout](uikit/uiview/requiresconstraintbasedlayout.md)
- [translatesAutoresizingMaskIntoConstraints](uikit/uiview/translatesautoresizingmaskintoconstraints.md)
