I need to access an object that it's present in many UIViewControllers from AppDelegate class. I want to update the top bar icon when a notification is received. What I have done so far:
UIViewController *vc = self.window.rootViewController;
If I had only one UIViewController then I would just cast the vc to my UIViewController and get the object. But the problem is that I have many UIViewControllers and I don't know which one will be active when I need it.
The object inside the UIViewControllers that I need it's called topBarManager. How can I access that object from AppDelegate? Thanks
EDIT:
One way to solve this is by using isKindOfClass
but I need to write all the cases for all the UIViewControllers.