alibaba / HandyJSON

A handy swift json-object serialization/deserialization library
Other
4.23k stars 634 forks source link

swift4 苹果推出了官方序列化策略Codable #236

Open mithyer opened 6 years ago

mithyer commented 6 years ago

我看到有些swift4的同学还在用这个,是有啥特殊需求?

swordray commented 6 years ago

@mithyer 感谢你的提醒,我试了一下 Codable 的设计是挺不错的,不过没有找到办法像 HandyJSON 一样很好地支持模型类的继承,定义在父类的通用字段比如 id 就不能序列化了,请问有没有这方面的经验?

mithyer commented 6 years ago

的确有这个问题,我也没解决方案,貌似只有等苹果改了。

swordray commented 6 years ago

仍然非常感谢,简单一点的项目我已经换成 Codable 了。

mithyer commented 6 years ago

https://bugs.swift.org/browse/SR-6507?jql=labels%20%3D%20Codable%20AND%20text%20~%20%22inherit%22 可以关注下这个,codable和继承相关的bug

tanpengsccd commented 6 years ago

codable 简单看了下,如有继承 感觉会有许多胶水代码。一旦后台改了啥,就会麻烦很多。 如果有ESJsonformat 类似 工具还是可以的

fynmm commented 5 years ago

Codable 支持 model是Int类型 ,接口返回 String 转换了吗