Reputation: 4390
I have a json stored in my app documents folder and I need to use it all over my views. I'm loading and adding the json to a NSMutableArray in each view. But now I learned that I can simple load the array to a NSMutableArray inside the AppDelegate once, and get the information directly from the AppDelegate when I need it.
Is it a bad practice?
Upvotes: 2
Views: 219
Reputation: 1519
I would better use a Singleton for your JSON storage
, than AppDelegate
.
So you can use it anywhere in your code like:
[[Storage sharedInstance] dataArray];
and you can add new methods to this class as your project grows
This is an article how to implement singletons in Objective-C
Upvotes: 3