---
title: "setViewControllers(_:direction:animated:completion:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uipageviewcontroller/setviewcontrollers(_:direction:animated:completion:)"
---

# setViewControllers(_:direction:animated:completion:)

Sets the view controllers to be displayed.

## Declaration

```swift
func setViewControllers(_ viewControllers: [UIViewController]?, direction: UIPageViewController.NavigationDirection, animated: Bool, completion: ((Bool) -> Void)? = nil)
```

## Parameters

- `viewControllers`: The view controller or view controllers to be displayed.
- `direction`: The navigation direction.
- `animated`: A Boolean value that indicates whether the transition is to be animated.
- `completion`: A block to be called when the page-turn animation completes. The block takes the following parameters:

## Discussion

Discussion The view controllers passed to this method are those that will be visible after the animation has completed. Use a data source to provide additional view controllers to which users navigate. If the transition style is UIPageViewController.TransitionStyle.pageCurl, the view controllers to pass in the viewControllers parameter depends on the spine location and the value of the isDoubleSided property:  |  |   |  |   |  |   |  |

## See Also

### Providing Content

- [UIPageViewController.NavigationDirection](uikit/uipageviewcontroller/navigationdirection.md)
- [viewControllers](uikit/uipageviewcontroller/viewcontrollers.md)
- [gestureRecognizers](uikit/uipageviewcontroller/gesturerecognizers.md)
