OK. I have an application which is using data that is stored in text files. The data is such that the application's users will drill down through a couple of levels of nested table views to get to the data that they need to access and alter, at which point any changes will be written back to the text files.
As the drilling down through the table views occurs, I am storing pointers into array elements that identify the current data items that are being accessed, so that as the data is changed, I can easily access and alter the affected data.
I am comfortable with how all of this is basically working so far.
The issue is that, in order to access the data, I need to be able to reference it across a number of different view controllers. To do this, I see that I have two basic options - using the AppDelegate file, or setting up the data controller as a singleton object.
I have seen a little discussion on which of these methods might be the better, but nothing really all that decisive.
From the memory management perspective, I can see benefits in using the AppDelegate for this: I can instanstiate the data controller within the app delegate, provide a simple accessor that allows any of the other view controllers to get and set data as needed, and at the end of the app, release the data controller within the AppDelegate's dealloc method.
Simple, and effective.
Perhaps a tad more elegant is the singleton approach, but it's not yet clear to me how that would be handled from the point of view of memory management.
So, from the experts here, please educate me and tell me which of these methods would be the better, and why?