A Swift protocol for automatic serialization and deserialization of objects into UserDefaults or Property List files.
PersistentStorageSerializable is a Swift library that provides a protocol for automatic serialization and deserialization of Swift objects into persistent storage like UserDefaults or Property List files. It solves the problem of writing repetitive boilerplate code to save and load app settings by leveraging reflection to handle property mapping automatically.
iOS and macOS developers who need a streamlined way to persist app settings, preferences, or configuration data without manually coding serialization logic for each property.
Developers choose PersistentStorageSerializable because it eliminates manual serialization code, supports both UserDefaults and Plist storage out of the box, and offers backward compatibility through customizable key mapping, all while keeping the API simple and protocol-oriented.
Swift library that makes easier to serialize the user's preferences (app's settings) with system User Defaults or Property List file on disk.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Uses reflection to traverse and serialize all properties without manual coding, as shown in the Settings struct example where flag, title, and number are automatically handled.
Supports both UserDefaults for simple preferences and Plist files for disk storage, allowing developers to choose based on needs, demonstrated with UserDefaultsStorage and PlistStorage classes.
Provides key mapping via the persistentStorageKey(for:) function, enabling easy migration from legacy stored data, illustrated in the ApplicationConfiguration example with old keys like 'oldGoogTitle'.
Automatically handles NSObject descendant properties using Key-Value Coding, ensuring compatibility with older or Objective-C-based code without additional setup.
Relies on an external Reflection library, which adds runtime performance overhead and a dependency risk if the library is not maintained or has bugs, as noted in the README's reliance on Reflection.
Restricts properties to property list types or requires manual archiving for custom objects, making it cumbersome for complex data models, as admitted for URL and non-standard types.
Adopters must explicitly set persistentStorage and persistentStorageKeyPrefix properties, adding boilerplate and potential setup errors, unlike more automated or convention-based solutions.
The README targets Swift 3.1 and has notes for Swift 4, indicating it might not be fully updated for newer Swift versions, risking compatibility and missing modern features like Codable.