<!--
{
  "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/UITabBarController/selectedViewController",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UITabBarController(py)selectedViewController"
  },
  "title" : "selectedViewController"
}
-->

# selectedViewController

The view controller associated with the currently selected tab item.

```
unowned(unsafe) var selectedViewController: UIViewController? { get set }
```

## Discussion

This view controller is the one whose custom view is currently displayed by the tab bar interface. The specified view controller must be in the [`viewControllers`](/documentation/UIKit/UITabBarController/viewControllers) array. Assigning a new view controller to this property changes the currently displayed view and also selects an appropriate tab in the tab bar. Changing the view controller also updates the [`selectedIndex`](/documentation/UIKit/UITabBarController/selectedIndex) property accordingly. The default value of this property is `nil`.

In iOS 3.0 and later, you can use this property to select any of the view controllers in the [`viewControllers`](/documentation/UIKit/UITabBarController/viewControllers) property. This includes view controllers that are managed by the More navigation controller and whose tab bar items are not visible in the tab bar. You can also use it to select the More navigation controller itself, which is available from the [`moreNavigationController`](/documentation/UIKit/UITabBarController/moreNavigationController) property. Prior to iOS 3.0, you could select only the More navigation controller and the subset of view controllers whose tab bar item was visible. Attempting to set this property to a view controller whose tab bar item was not visible had no effect.

> Note:
> The More interface is not available in tvOS.

---

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)