1
你们可以帮我创建使用ObjectMapper跟踪JSON数据的Swift对象吗?JSON响应数据到Swift对象[ObjectMapper]
[{
"location": "Toronto, Canada",
"three_day_forecast": [
{
"conditions": "Partly cloudy",
"day" : "Monday",
"temperature": 20
},
{
"conditions": "Showers",
"day" : "Tuesday",
"temperature": 22
},
{
"conditions": "Sunny",
"day" : "Wednesday",
"temperature": 28
}
]
}
]
[生成的模型](https://gist.github.com/romainmenke/3d2b7a0ade82ade9395c15fe08353e32) –
@appzYourLife结构不允许类型为Self的属性。所以类可以更好地表示可能发生的JSON。一个可用的初始化很难概括。有些人只需要完整数据的对象,而另一些人则不介意不完整的对象。 –
这段代码能帮助你吗? –