Reputation: 143
The root view of my application is a UITabBarController.
In the second tab I have a UICollectionView which is loading data from Firebase inside viewDidLoad.
I am trying to set the badgeValue for the second tabBar item based on the data inside that viewController, but the data isn't loaded until the second tab bar is tapped.
How do I load data for the second viewController before it is instantiated? Should I be loading it somewhere else?
Upvotes: 0
Views: 499
Reputation: 1535
If you want to set badgeValue when application starts or from another controller then you need to call API/Webservice in global method like from Appdelegate or any shared instance and then set badgeValue from that method
Upvotes: 2