---
title: viewControllers
framework: uikit
role: symbol
role_heading: Instance Property
path: uikit/uinavigationcontroller/viewcontrollers
---

# viewControllers

The view controllers currently on the navigation stack.

## Declaration

```swift
var viewControllers: [UIViewController] { get set }
```

## Discussion

Discussion The root view controller is at index 0 in the array, the back view controller is at index n-2, and the top controller is at index n-1, where n is the number of items in the array. Assigning a new array of view controllers to this property is equivalent to calling the setViewControllers(_:animated:) method with the animated parameter set to false.

## See Also

### Accessing items on the navigation stack

- [topViewController](uikit/uinavigationcontroller/topviewcontroller.md)
- [visibleViewController](uikit/uinavigationcontroller/visibleviewcontroller.md)
- [setViewControllers(_:animated:)](uikit/uinavigationcontroller/setviewcontrollers(_:animated:).md)
