I tried the solution from and observed that on some changes of the tab the background of my tabbar vanished, letting me fully see underneath content for a split second and then restored to it's previous state.
Also I had issues with NavigationControllers where the NavigationBar is hidden on some of the ViewControllers. Hiding and unhiding them in view lifecycle methods become visible and animated although the transitionDuration (code from ) was .zero.
So I came up with something else.
func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
if let targetIndex = tabBarController.viewControllers?.firstIndex(where: { $0 == viewController }) {
UIView.performWithoutAnimation {
tabBarController.selectedIndex = targetIndex
}
}
return false
}
Basically I'm intercepting normal tab changes by pressing on them and then programmatically perform them instead and suppress the animations.
Just that works great and I couldn't find any issues with it, yet.
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: