Is it possible to change UITabBarItem badge color

1110 picture 1110 · Nov 12, 2012 · Viewed 28.1k times · Source

I want to change background color of UITabBarItem badge but can't find any resource on how to make it.

enter image description here

Answer

Nuno Gonçalves picture Nuno Gonçalves · Sep 28, 2016

UITabBarItem has this available since iOS 10.

var badgeColor: UIColor? { get set }

It's also available via appearence.

if #available(iOS 10, *) {
   UITabBarItem.appearance().badgeColor = .green
}

reference docs: https://developer.apple.com/reference/uikit/uitabbaritem/1648567-badgecolor