Running an existing Xcode project in an iPad OS 18 simulator is automatically using the newly introduced tab bar view, moved from the bottom to the top.
Unfortunately, the isEnabled property on a tar bar item is no longer honored.
In Xcode's Storyboard builder, some tab bar items are initially disabled. (can't add a screenshot here, I will try to do that after posting)
The iPad OS 17 simulator shows them correctly as disabled and any user interaction is suppressed as expected.
The iPad OS 18 simulator shows them as active and they can be selected. Also setting them to disabled inside of the UITabBarViewController doesn't work:
for item in self.tabBar.items! {
if item.tag != 99 {
item.isEnabled = false
}
}
They stay enabled and selectable.
As a workaround, I implemented the UITabBarViewControllerDelegate and overrode this method:
func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
if Global.shared.accessToken == nil {
if viewController is LoginViewController || viewController is SettingsViewController {
return true
} else {
return false
}
}
return true
}
The user can no longer select the tabs, however, there is no visual indicator that they are not selectable.
I cannot find any indication in the release notes or documentation, that this behavior is intentional. So I assume this is a bug.