---
title: containerViewWillLayoutSubviews()
framework: uikit
role: symbol
role_heading: Instance Method
path: uikit/uipresentationcontroller/containerviewwilllayoutsubviews()
---

# containerViewWillLayoutSubviews()

Notifies the presentation controller that layout is about to begin on the views of the container view.

## Declaration

```swift
func containerViewWillLayoutSubviews()
```

## Discussion

Discussion UIKit calls this method before adjusting the layout of the views in the container view. Use this method and the containerViewDidLayoutSubviews() method to update any custom views managed by your presentation controller. In iOS 18 and later, UIKit supports automatic trait tracking inside this method for traits from this presentation controller’s traitCollection and the traitCollection of its containerView. For more information, see Automatic trait tracking. This method supports automatic observation tracking. For more information, see Updating views automatically with observation tracking.

## See Also

### Observing data in presentation controllers

- [containerViewDidLayoutSubviews()](uikit/uipresentationcontroller/containerviewdidlayoutsubviews().md)
