winddpan / CodableWrapper

@CodingKey("encoder", "decoder") var cool: Bool = true
MIT License
362 stars 30 forks source link

如果想要排除某个属性,该怎么操作? #16

Closed kellenyangs closed 1 year ago

kellenyangs commented 1 year ago

如下列表,我想要排除createAt属性的序列化以及反序列化

struct Article {
    @Codec var title: String?
    @Codec var info: String?
    @Codec var desc: String?
    @Codec var createAt: String?
}
winddpan commented 1 year ago
@Codec(transformer: TransformOf<String?, Any>(fromJSON: { _ in nil }, toJSON: { _ in nil }))

或者实现TransformType做一个封装