Using NSUserDefaults is the standard way to save app settings, but using the standard NSUSerDefaults class is not without it’s disadvantages.
Here’s a helper library submitted by Ivan Rublev called VRAppSettings that simplifies the task of defining and saving app settings.
The readme states the following benefits:
– The settings are defined as properties of the primitive type or object type (conforming to the NSCoding protocol).
– No need to choose the appropriate -setType:forKey: or -typeForKey: methods, just write or read properties!
– Consistency and range checks of settings values in setters and getters!
– No misspelling of settings names anymore, compiler checks everything!
– The Xcode refactoring tool can be used to change the setting’s name across the project.
– The possibility to reset all changes in the settings object to what is in the user defaults now.
– Several independent settings sets around the project.
– Settings sets accessibility either in the app or in the class scope.
– Storing the whole class in the user defaults protects the individual settings from any external change.
You can read more about VRAppSettings over on Ivan’s blog.
You can find VRAppSettings on Github here.
A nice library for simplifying app settings.
Submit A Resource
Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?
You can submit the url here.
The resources we feel will appeal to our readers the most will be posted on the front page.