I have read and understand the way NSUserDefaults can be used to save preferences for my app to the file system. I am also aware of the need to register defaults before using them later in the app.
What I am not sure of, however, is if it is okay to register defaults from various classes in my app. For example, in the AppDelegate I want to register a preference that belongs to the entire app, but in a Theme-class I want to use (and therefore register) preferences only used for getting and setting the app’s theme. More classes will have their own needs as far as user defaults go, so this applies to multiple parts of any project I work on.
Is this way of keeping the preferences with the classes they belong to the correct way of working?
Yes, you can register defaults from multiple classes. When you register a new default, it just adds that new key/value pair to the registration domain (there is only one of those for the app). I think the way you’re doing it is quite reasonable.