I am retrieving data via SignalR and keeping the most recent data returned in a dictionary that exists in my WebServices class.
I'd like to be able to have a pointer to this dictionary and be able to use the data in many other classes / viewcontrollers.
I want to avoid creating an instance of my WebServices class everywhere I use the data.
How can I accomplish this?
The usual way to share data like this is to put it in your app delegate class.
Just create the dictionary in your appDelegate, and whenever you need to access it just retrieve it with:
MyAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
NSDictionary *myDictionary = appDelegate.myDictionary;
// Do whatever you want with myDictionary
// ...
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments