I'm developing my first iPhone app, and while implementing user preferences, I have a few questions on how to best implement this.
Assume the basic MVC pattern: MainView displaying data stored in a Model object; MainViewController handling the app logic.
For the options, I have an OptionsView and an OptionsViewController. A RootViewController handles swapping of the Main and Options views.
First of all, what about the options data? Would I want to make an NSOjbect-derived class to store them (an OptionsModel)? Or maybe a simple NSDictionary would suffice?
Second, who owns the options data? They are application prefs, but storing them in the AppDelegate seems wrong. MainViewController mostly cares about the options, and OptionsViewController needs to edit them, but those guys don't know about each other, nor should they, probably. RootViewController knows about both, so he's in a good position to pass the options between them, but again, that seems wrong.
Finally, MainViewController will frequently need to access the options. Should he call into the options model each time to get some option, or cache his own copy? I don't like the idea of extra overhead retrieving options data, but having the MainViewController have copies which can get out of sync is also not very appealing.