Reputation: 1541
Is it possible to create a custom tabBarController
class in swift to animate programmatic and interactive transitions between tabs?
Upvotes: 5
Views: 5094
Reputation: 4101
I just figured this out, and posted an answer on another thread (link below). It adds a method:
tabBarController.setSelectedWithIndex(1)
to get this done with an animation.
I hope it works for you!
Answer: https://stackoverflow.com/a/57116930/1993937
Upvotes: 1
Reputation: 429
You can try this for transition animation on tabbar selecetion
func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
guard let fromView = selectedViewController?.view, let toView = viewController.view else {
return false
}
UIView.transition(from: fromView, to: toView, duration: 0.3, options: [.transitionCrossDissolve], completion: nil)
return true }
for reference use this link
How to animate Tab bar tab switch with a CrossDissolve slide transition?
Upvotes: 1