CodableWrappers
Make Custom Serialization of Swift Codable Types easy with Annotations
Install / Use
/learn @GottaGetSwifty/CodableWrappersREADME
CodableWrappers
Simplified Serialization with Property Wrappers
Make Complex Codable Serialization a breeze with declarative annotations!
@CustomCodable @SnakeCase
struct User: Codable {
let firstName: String
let lastName: String
@SecondsSince1970DateCoding
var joinDate: Date
@CustomCodingKey("data")
var imageData: Data
}
3.0 released! Release Notes
Documentation
Full DocC documentation here thanks to the Swift Package Index!
Installation
Swift Package Manager *Preferred*
URL:
https://github.com/GottaGetSwifty/CodableWrappers.git
Manifest:
dependencies: [
.package(url: "https://github.com/GottaGetSwifty/CodableWrappers.git", .upToNextMajor(from: "3.0.0" )),
]
CocoaPods
*WARNING* CocoaPods is not currently supported for version 3.0 to avoid complications with Swift Macros.
pod 'CodableWrappers', '~> 2.0.0'
Available CodingKey Macros
- @CustomCodable
- @CustomCodingKey(String)
- @CodingKeyPrefix(String)
- @CodingKeySuffix(String)
- @CamelCase
- @FlatCase
- @PascalCase
- @UpperCase
- @SnakeCase
- @CamelSnakeCase
- @PascalSnakeCase
- @ScreamingSnakeCase
- @KebabCase
- @CamelKebabCase
- @PascalKebabCase
- @ScreamingKebabCase
Available Property Wrappers
- @EncodeNulls
- Lossy Collections
- Empty Defaults
- Other Fallbacks
- @OmitCoding
- @Base64Coding
- @SecondsSince1970DateCoding
- @MillisecondsSince1970DateCoding
- @DateFormatterCoding<DateFormatterStaticCoder>
- @ISO8601Coding
- @ISO8601DateFormatStyleCoding<ISO8601DateFormatterStaticCoder>
- @NonConformingFloatCoding<ValueProvider>
- @NonConformingDoubleCoding<ValueProvider>
- Bool Coding
- Additional Customization
- Property Mutability
- Only Encoding or Decoding
Additional Customization
Additional Links
Compatibility
- 3.x supports Swift 5.9+
- 2.x supports Swift 5.2+
- 1.x supports Swift 5.1+
Contributions
If there is a standard Serialization or Coding Key strategy that could be added feel free to open an issue requesting it and/or submit a pull request with the new option.
Related Skills
node-connect
341.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
341.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
84.4kCommit, push, and open a PR
