Question: I refactored my storyboard and now I'm unable to set the badge value on the refactored storyboard.

This is the main story board and MessageCenter is the refactored storyboard.

[![enter image description here](https://i.stack.imgur.com/Qflvp.png)](https://i.stack.imgur.com/Qflvp.png)

Message Center StoryBoard:

[![enter image description here](https://i.stack.imgur.com/c2fM4.png)](https://i.stack.imgur.com/c2fM4.png)

I'm setting the badge value in the app delegate, which isn't working:

if let tabBarController = self.window!.rootViewController as? UITabBarController {
 tabBarController.tabBar.items![2](https://i.stack.imgur.com/c2fM4.png).badgeValue = "3"
}

Any ideas?

Answer: 
Try with this code in your TabBarCustomViewController: 

```
DispatchQueue.main.async(execute: {
                self.tabBar.items?[3].badgeValue = "3"
})

```
if let tabBarController = self.window?.rootViewController as? UITabBarController {
tabBarController.viewControllers?[2].tabBarItem.badgeValue = "3"
}