---
title: viewWillLayout()
framework: appkit
role: symbol
role_heading: Instance Method
path: appkit/nsviewcontroller/viewwilllayout()
---

# viewWillLayout()

Called just before the layout() method of the view controller’s view is called.

## Declaration

```swift
func viewWillLayout()
```

## Mentioned in

Updating views automatically with observation tracking

## Discussion

Discussion You can override this method to perform tasks to precede the layout of the view controller’s view, such as adjusting Auto Layout constraints. If you override this method, call this method on super at some point in your implementation in case a superclass also overrides this method. The default implementation of this method does nothing. This method supports automatic observation tracking. For more information, see Updating views automatically with observation tracking.

## See Also

### Observing data in view controllers

- [viewDidLayout()](appkit/nsviewcontroller/viewdidlayout().md)
- [updateViewConstraints()](appkit/nsviewcontroller/updateviewconstraints().md)
