Swift's JSONDecoder with multiple date formats in a JSON string?

前端 未结 8 1560
既然无缘
既然无缘 2020-12-14 06:48

Swift\'s JSONDecoder offers a dateDecodingStrategy property, which allows us to define how to interpret incoming date strings in accordance with a

8条回答
  •  粉色の甜心
    2020-12-14 07:36

    If you have multiple dates with different formats in single model, its bit difficult to apply .dateDecodingStrategy for each dates.

    Check here https://gist.github.com/romanroibu/089ec641757604bf78a390654c437cb0 for a handy solution

提交回复
热议问题