<!--
{
  "availability" : [
    "iOS: 3.0.0 -",
    "iPadOS: 3.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UITabBarControllerDelegate/tabBarController(_:shouldSelect:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UITabBarControllerDelegate(im)tabBarController:shouldSelectViewController:"
  },
  "title" : "tabBarController(_:shouldSelect:)"
}
-->

# tabBarController(_:shouldSelect:)

Asks the delegate whether the specified view controller should be made active.

```
optional func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool
```

## Parameters

`tabBarController`

The tab bar controller containing `viewController`.

`viewController`

The view controller belonging to the tab that was tapped by the user.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the view controller’s tab should be selected or <doc://com.apple.documentation/documentation/Swift/false> if the current tab should remain active.

## Discussion

The tab bar controller calls this method in response to the user tapping a tab bar item. You can use this method to dynamically decide whether a given tab should be made the active tab.

---

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)