EasyCodable
类似于 ObjectMapper 的编码语法且不会抛出错误
示例
struct Ball: Codable {
var weight: Double
var colorHex: String
init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.weight <- container[.weight]
self.colorHex <- container[.colorHex]
}
}
需求
安装
EasyCodable 通过 CocoaPods 提供。要安装它,只需将以下行添加到 Podfile 中
pod 'EasyCodable'
作者
Zoro4rk, [email protected]
许可证
EasyCodable 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。