我原先一直使用ObjectMapper(https://github.com/tristanhimmelman/ObjectMapper)
因?yàn)榭磶?kù)已經(jīng)幾年不維護(hù)了(因?yàn)樘O(píng)果后面推出Codable方式)
所以就重新找轉(zhuǎn)化庫(kù)
由參考文章得到的結(jié)論是:
推薦SwiftMacros方案(比如1.0.0版本的CodableWrapper和MetaCodable庫(kù))
先集入MetaCodable庫(kù)
https://github.com/SwiftyLab/MetaCodable
報(bào)了:Failed to receive result from plugin (from macro 'Codable') 未知原因,未解決
并且文檔也沒(méi)發(fā)現(xiàn)model,class,繼承的使用。我需要這功能。 先pass
集入CodableWrapper
https://github.com/winddpan/CodableWrapper
類繼承功能支持。使用效果不錯(cuò),優(yōu)先推薦
評(píng)論區(qū)有SmartCodable作者回復(fù):我也去驗(yàn)證看看
還有SmartCodable(已驗(yàn)證功能完好,可使用)
https://github.com/intsig171/SmartCodable
SmartCodable整體使用很不錯(cuò),驗(yàn)證model,class,繼承的使用有問(wèn)題,先pass。我需要這功能。
然后就是我原先的ObjectMapper,功能穩(wěn)定性還很ok,還能搭配jsonexport工具使用。
總結(jié):優(yōu)先使用CodableWrapper,然后ObjectMapper吧