<!--
{
  "availability" : [
    "iOS: 27.1.0 -",
    "iPadOS: 27.1.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIArrangementViewController/setViewController(_:for:animated:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "s:So27UIArrangementViewControllerC5UIKitE03setbC0_3for8animatedySo06UIViewC0CSg_AbCE0B9PlacementVSbtF"
  },
  "title" : "setViewController(_:for:animated:)"
}
-->

# setViewController(_:for:animated:)

Sets the view controller in the arrangement for a specific placement.

```
@MainActor @preconcurrency final func setViewController(_ viewController: UIViewController?, for placement: UIArrangementViewController.ViewPlacement, animated: Bool = false)
```

## Parameters

`viewController`

The view controller to place in the arrangement, or `nil` to remove the view controller currently in the placement.

`placement`

The placement of the view controller in the arrangement.

`animated`

Whether to animate the view controller transition.

---

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)