---
title: "tabBarController(_:shouldSelect:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uitabbarcontrollerdelegate/tabbarcontroller(_:shouldselect:)"
---

# tabBarController(_:shouldSelect:)

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

## Declaration

```swift
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

Return Value true if the view controller’s tab should be selected or false if the current tab should remain active.

## Discussion

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.

## See Also

### Managing tab bar selections

- [tabBarController(_:didSelect:)](uikit/uitabbarcontrollerdelegate/tabbarcontroller(_:didselect:).md)
