How to definitively set UITabBar background color and tint color

In similar fashion to how UINavigationBar is by default transparent on iOS 15 when there is no content behind it, the UITabBar works the same way. This might either be a nice visual refresh you get for free (since it is turned on by default once you build with Xcode 13) or it might cause a lot of issues for your app.

if #available(iOS 13.0, *) { 
    let tabBarAppearance: UITabBarAppearance = UITabBarAppearance() 
    tabBarAppearance.configureWithDefaultBackground() 
    tabBarAppearance.backgroundColor = UIColor.tabBarBackground 
    UITabBar.appearance().standardAppearance = tabBarAppearance 
}
if #available(iOS 15.0, *) { 
    UITabBar.appearance().scrollEdgeAppearance = tabBarAppearance 
} 

Set tab bar background color with barTintColor:

self.tabBar.barTintColor = UIColor.blueColor()
//or
UITabBar.appearance().barTintColor = UIColor.blueColor()

And for tab bar tint color:

self.tabBar.tintColor = UIColor.whiteColor() // Selected tab color
//or
UITabBar.appearance().tintColor = UIColor.whiteColor()

enter image description here


If you want to set tabbar's tint and barTint color implicitly then in your Appdelegate.swift,

    UITabBar.appearance().barTintColor = .orange
    UITabBar.appearance().tintColor = .green

If you want to set tabbar's tint and barTint color for specific viewController then in ViewController.swift,

 self.tabBarController?.tabBar.tintColor = .orange
 self.tabBarController?.tabBar.barTintColor = .green