<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIViewController/collapseSecondaryViewController(_:for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIViewController(im)collapseSecondaryViewController:forSplitViewController:"
  },
  "title" : "collapseSecondaryViewController(_:for:)"
}
-->

# collapseSecondaryViewController(_:for:)

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

```
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

This method provides default behavior when you do not overwrite the [`splitViewController(_:collapseSecondary:onto:)`](/documentation/UIKit/UISplitViewControllerDelegate/splitViewController(_:collapseSecondary:onto:)) method. The primary view controller associated with the split view controller is displayed.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)