<!--
{
  "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/UISplitViewControllerDelegate/splitViewController(_:collapseSecondary:onto:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UISplitViewControllerDelegate(im)splitViewController:collapseSecondaryViewController:ontoPrimaryViewController:"
  },
  "title" : "splitViewController(_:collapseSecondary:onto:)"
}
-->

# splitViewController(_:collapseSecondary:onto:)

Asks the delegate to adjust the primary view controller and to incorporate the secondary view controller into the collapsed interface.

```
optional func splitViewController(_ splitViewController: UISplitViewController, collapseSecondary secondaryViewController: UIViewController, onto primaryViewController: UIViewController) -> Bool
```

## Parameters

`splitViewController`

The split view controller whose interface is collapsing.

`secondaryViewController`

The secondary view controller of the split view interface.

`primaryViewController`

The primary view controller of the split view interface. If you implement the [`primaryViewController(forCollapsing:)`](/documentation/UIKit/UISplitViewControllerDelegate/primaryViewController(forCollapsing:)) method in your delegate, this object is the one that method returns.

## Return Value

<doc://com.apple.documentation/documentation/Swift/false> to let the split view controller try to incorporate the secondary view controller’s content into the collapsed interface, or <doc://com.apple.documentation/documentation/Swift/true> to indicate that you do not want the split view controller to do anything with the secondary view controller.

## Discussion

This delegate method only applies to classic split view interfaces. For more information, see [`Split view styles`](/documentation/UIKit/UISplitViewController#Split-view-styles).

This method is your opportunity to perform any necessary tasks related to the transition to a collapsed interface. After this method returns, the split view controller removes the secondary view controller from its [`viewControllers`](/documentation/UIKit/UISplitViewController/viewControllers) array, leaving the primary view controller as its only child. In your implementation of this method, you might prepare the primary view controller for display in a compact environment, or you might attempt to incorporate the secondary view controller’s content into the newly collapsed interface.

Returning <doc://com.apple.documentation/documentation/Swift/false> tells the split view controller to use its default behavior to try to incorporate the secondary view controller into the collapsed interface. When you return <doc://com.apple.documentation/documentation/Swift/false>, the split view controller calls the [`collapseSecondaryViewController(_:for:)`](/documentation/UIKit/UIViewController/collapseSecondaryViewController(_:for:)) method of the primary view controller, giving it a chance to do something with the secondary view controller’s content. Most view controllers do nothing by default, but the [`UINavigationController`](/documentation/UIKit/UINavigationController) class responds by pushing the secondary view controller onto its navigation stack.

Returning <doc://com.apple.documentation/documentation/Swift/true> from this method tells the split view controller not to apply any default behavior. You might return <doc://com.apple.documentation/documentation/Swift/true> in cases where you do not want the secondary view controller’s content incorporated into the resulting interface.

---

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)