A Swift library that simplifies custom serialization of Codable types using declarative property wrapper annotations.
CodableWrappers is a Swift library that simplifies complex Codable serialization using declarative property wrapper annotations. It eliminates verbose custom CodingKeys and Codable implementations by allowing developers to define serialization behavior directly at the property level with simple annotations, reducing boilerplate and improving code readability.
Swift developers working on projects that require JSON or other Codable serialization, particularly those dealing with APIs that have inconsistent naming conventions, multiple date formats, or need graceful handling of malformed data.
Developers choose CodableWrappers over manual Codable implementations because it provides a declarative, annotation-based approach that drastically reduces boilerplate code, supports a wide range of serialization strategies out-of-the-box, and makes serialization logic more maintainable and readable.
Make Custom Serialization of Swift Codable Types easy with Annotations
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 verbose custom CodingKeys and Codable implementations by using property wrapper annotations, as shown in the README example where @SnakeCase automatically handles key transformation without manual code.
Supports a wide range of serialization strategies out-of-the-box, including multiple date formats (e.g., seconds/milliseconds since 1970, ISO8601), base64 encoding, and various naming conventions like snake_case and kebab-case via macros.
Provides lossy collection decoding and default value fallbacks, allowing applications to handle missing or malformed data without crashing, as documented in the property wrappers section for robust API integration.
Enables fine-grained control over encoding behavior, such as omitting properties, encoding nulls, or applying rules only during encoding or decoding, which enhances customization for complex serialization scenarios.
Version 3.0 does not support CocoaPods due to complications with Swift Macros, forcing teams using CocoaPods to stick with older versions or switch dependency managers, as warned in the installation section.
Relies on Swift Macros for coding key transformations in version 3.0, which can introduce build complexity and may not be stable in all Swift environments, potentially causing migration issues for older projects.
The use of property wrappers and macros might add runtime overhead compared to hand-rolled Codable implementations, which could be a concern for high-volume serialization tasks in performance-sensitive apps.