---
title: "collapseSecondaryViewController(_:for:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uiviewcontroller/collapsesecondaryviewcontroller(_:for:)"
---

# collapseSecondaryViewController(_:for:)

Called when a split view controller transitions to a compact-width size class.

## Declaration

```swift
func collapseSecondaryViewController(_ secondaryViewController: UIViewController, for splitViewController: UISplitViewController)
```

## Parameters

- `secondaryViewController`: The secondary view controller associated with the split view controller.
- `splitViewController`: The current split view controller.

## Discussion

Discussion This method provides default behavior when you do not overwrite the splitViewController(_:collapseSecondary:onto:) method. The primary view controller associated with the split view controller is displayed.

## See Also

### Adapting to environment changes

- [separateSecondaryViewController(for:)](uikit/uiviewcontroller/separatesecondaryviewcontroller(for:).md)
