A Swift library providing a modern interface to UserDefaults with Codable support for storing custom objects.
Default is a Swift library that extends UserDefaults to support storing custom Codable objects and provides a modern, type-safe API via the DefaultStorable protocol. It solves the problem of error-prone string keys and manual NSCoding implementation when persisting settings in Apple's platforms.
iOS, macOS, tvOS, and watchOS developers who need a cleaner, safer way to store and retrieve user settings or app state using UserDefaults.
Developers choose Default because it eliminates the boilerplate of NSCoding, reduces key-related bugs through type safety, and offers a declarative approach to managing UserDefaults with full Codable integration.
Modern interface to UserDefaults + Codable support
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Eliminates NSCoding boilerplate by allowing any Codable-conforming object to be stored directly, as shown with structs like VisualSettings in the README.
Uses type names as default keys via the DefaultStorable protocol, reducing typos and simplifying tracking compared to manual string keys.
Supports overriding default keys and UserDefaults database, enabling integration with custom suites or specific storage needs.
Built for Swift 5.0+, leveraging Codable for a future-proof approach that aligns with Apple's evolving frameworks.
Constrained by UserDefaults' small storage capacity and lack of encryption, making it unsuitable for large or sensitive data.
Defining Codable objects and conforming to DefaultStorable adds complexity for trivial storage needs, where vanilla UserDefaults might suffice.
Lacks features for migrating data from NSCoding or older formats, requiring manual handling that can be error-prone.