Swift - Create data model from JSON response

后端 未结 6 1982
小鲜肉
小鲜肉 2021-02-02 01:08

I\'m learning Swift lang and one of the things that would be great to hear others input about is \"How you handle models from JSON responses\"? For example -

I have

6条回答
  •  日久生厌
    2021-02-02 01:24

    If you want a more rigorous approach and have access to JSON schemas as meta description for your JSON documents, I wrote a code generator which can handle those (JSON schema, draft 4):

    https://github.com/werner77/MappableObjectGenerator

    My tools supports basically any programming language, because it is based on code generation templates, but is focussed on ObjectiveC and Swift 4 support right now.

提交回复
热议问题