Animate tab bar switches with a transition effect for UITabBarViewController.

I was searching the web for answers on how to give the CurlUp / CrossDissolve / FlipFromRight / FlipFromLeft / CurlDown / FlipFromTop / FlipFromBottom transition effect for the UITabBar Tab Switch.

I found this answer, but it has a bug or a black screen when you tap on the same tab twice, i.e., the destination and current tab are the same.

So I solve this issue with my logic and additional if and else statement.

So here is the final answer without any bugs.

Step 01:
Add these two classes as Super Class to your UITabBarViewController

UITabBarController, UITabBarControllerDelegate

Step 02:
Now add the following code to your viewDidLoad Function in your UITabBarViewController

self.delegate = self

So your viewDidLoad Function will look something like this:

override func viewDidLoad() {

// Do any additional setup after loading the view.

self.delegate = self;

Step 03:
Now add the following Function to your UITabBarViewController file.

func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
let fromView = selectedViewController?.view
let toView = viewController.view

if fromView !== toView {
    UIView.transition(from: fromView!, to: toView!, duration: 0.5, options: [.transitionCrossDissolve], completion: nil)
} else {


return true

Hopefully, if you have done everything right, you should see the Tab Bar transition on the Tab Bar switch.

Hope it helps,

Thanks & Regards
Mandar Apte

Published by Mandar Apte

Mandar is a Mumbai-based multi-disciplinary designer with UX/UI, Logo, Symbol, and Brand Identity design expertise. He currently runs his Mudrkashar Linguistic Apple iPhone, iPad, and Mac app business in the heart of Mumbai city.

Join the Conversation


  1. Thank you for the guide. I’m new to iOS programming and I put the delegate in all my viewcontroller files and they conflicted with each other.

Leave a comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.