<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UINavigationController/pushViewController(_:animated:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UINavigationController(im)pushViewController:animated:"
  },
  "title" : "pushViewController(_:animated:)"
}
-->

# pushViewController(_:animated:)

Pushes a view controller onto the receiver’s stack and updates the display.

```
func pushViewController(_ viewController: UIViewController, animated: Bool)
```

## Parameters

`viewController`

The view controller to push onto the stack. This object cannot be a tab bar controller. If the view controller is already on the navigation stack, this method throws an exception.

`animated`

Specify <doc://com.apple.documentation/documentation/Swift/true> to animate the transition or <doc://com.apple.documentation/documentation/Swift/false> if you do not want the transition to be animated. You might specify <doc://com.apple.documentation/documentation/Swift/false> if you are setting up the navigation controller at launch time.

## Discussion

The object in the `viewController` parameter becomes the top view controller on the navigation stack. Pushing a view controller causes its view to be embedded in the navigation interface. If the `animated` parameter is <doc://com.apple.documentation/documentation/Swift/true>, the view is animated into position; otherwise, the view is simply displayed in its final location.

In addition to displaying the view associated with the new view controller at the top of the stack, this method also updates the navigation bar and tool bar accordingly. For information on how the navigation bar is updated, see [`Updating the navigation bar`](/documentation/UIKit/UINavigationController#Updating-the-navigation-bar).

---

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)