CodableWrappers

API Docs codecov

使用 属性包装器 简化序列化

使用声明式注解,轻松进行复杂的 Codable 序列化!

@CustomCodable @SnakeCase
struct User: Codable {
    let firstName: String
    let lastName: String
    @SecondsSince1970DateCoding
    var joinDate: Date
    @CustomCodingKey("data")
    var imageData: Data
}

3.0 已发布! 发行说明


文档

感谢 Swift Package Index!完整的 DocC 文档在此

安装

Swift Package Manager *首选*

URL

https://github.com/GottaGetSwifty/CodableWrappers.git

Manifest

dependencies: [
    .package(url: "https://github.com/GottaGetSwifty/CodableWrappers.git", .upToNextMajor(from: "3.0.0" )),
]

CocoaPods

*警告* 为了避免 Swift 宏的复杂性,当前版本 3.0 不支持 CocoaPods。

pod 'CodableWrappers', '~> 2.0.0'

可用的 CodingKey 宏

可用的属性包装器

其他自定义

其他链接


兼容性


贡献

如果需要添加标准的序列化或 Coding Key 策略,请随时提出 issue 请求或提交包含新选项的 pull request。