eshwavin / SETabView

SETabView is a TabBar with simple yet beautiful animations that makes your apps look cool!
MIT License
70 stars 5 forks source link

Unable to add badge on tab icons #3

Open BilalAhmedKhan-IosDeveloper opened 9 months ago

BilalAhmedKhan-IosDeveloper commented 9 months ago

I tried adding the badge to tabicon, but its not showing up. tried tabItem?.badgeValue.

private func setTabIcons() {
    _tabBar.tabImages = _viewControllers.map({ (viewController) -> UIImage in
        var tabItem: UITabBarItem?

        if let controller = (viewController as? UINavigationController)?.topViewController {
            if let seTabItemProvider = controller as? SETabItemProvider {
                tabItem = seTabItemProvider.seTabBarItem
            }
            else {
                tabItem = controller.tabBarItem
            }
        }
        else if let controller = viewController as? SETabItemProvider {
            tabItem = controller.seTabBarItem
        }
        else {
            tabItem = viewController.tabBarItem
        }

        return tabItem?.image ?? UIImage(named: "empty")!
    })
}