---
title: "setViewController(_:for:animated:)"
framework: UIKit
role: symbol
role_heading: Instance Method
platforms: [iOS 27.1+, iPadOS 27.1+]
path: "uikit/uiarrangementviewcontroller/setviewcontroller(_:for:animated:)"
---

# setViewController(_:for:animated:)

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

## Declaration

```swift
@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.

## See Also

### Managing arrangement view controllers

- [UIArrangementViewController.ViewPlacement](uikit/uiarrangementviewcontroller/viewplacement.md)
- [viewController(for:)](uikit/uiarrangementviewcontroller/viewcontroller(for:).md)
- [placement(for:)](uikit/uiarrangementviewcontroller/placement(for:).md)
