Description
UserDefaults interface is not strictly-typed. TypedPreferences enables class implementation where all dynamic @objc-declared properties are automatically saved/loaded to/from UserDefaults.
Thus:
// Instead of:
let defaults = UserDefaults.standard
print("name: \(defaults.value(forKey: "name") as? String)")
defaults.set("Updated name", forKey: "name")
// Typed property-based usage looks like:
let preferences = YourPreferencesSubclass()
print("name: \(preferences.name)")
preferences.name = "Updated name"
Installation
TypedPreferences is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'TypedPreferences'
License
TypedPreferences is available under the MIT license. See the LICENSE file for more info.