it's been a long time I don't use Swift.
(我已经很久不使用Swift了。)
I have a response data like this and I saved it into an array named responseData
:
(我有一个这样的响应数据,并将其保存到名为responseData
的数组中:)
[
{
"type": "Switch",
"name": "Switch1",
"search_key": "is_promotion",
"key": "is_promotion=1",
"icon": ""
},
{
"type": "Switch",
"name": "Switch2",
"search_key": "shop_type",
"key": "shop_type=2",
"icon": ""
},
{
"type": "Switch",
"name": "Switch3",
"search_key": "is_certified",
"key": "is_certified=1",
"icon": ""
},
{
"type": "Switch",
"name": "Switch4",
"search_key": "shop_free_shipping",
"key": "shop_free_shipping=1",
"icon": ""
},
{
"type": "Switch",
"name": "Switch5",
"search_key": "is_loyalty",
"key": "is_loyalty=1",
"icon": ""
},
{
"type": "Switch",
"name": "Switch6",
"search_key": "is_using_instant",
"key": "is_using_instant=1",
"icon": ""
},
{
"type": "Switch",
"name": "Switch7",
"search_key": "is_installment",
"key": "is_installment=1",
"icon": ""
},
{
"type": "Range",
"name": "Price Range",
"search_key": "level_Price_Max_Min",
"value": [
{
"option_id": 0,
"option_name": 0
},
{
"option_id": 0,
"option_name": 10000000
}
]
},
{
"type": "ColorTerm",
"name": "Color",
"search_key": "color_key",
"value": [
{
"option_id": 605,
"value": "Black",
"color_id": 13,
"image": "",
"option_name": "Black",
"background": "#000000",
"option_active": "",
"facet_count": 52655
},
Now I wanna group all dictionary with type Switch
into one array and I can access to the keys inside it, then present data of both Switch
type array and the others type on a UITableView
which have 2 section ( Switch
type in section 0).
(现在,我想将所有类型为Switch
字典分组到一个数组中,然后可以访问其中的键,然后在具有2个部分的UITableView
上显示Switch
类型数组和其他类型的数据(第2部分中的Switch
类型)。)
How can I do it? (我该怎么做?)
I have to search some other solution but I don't understand how to apply them to my code for work. (我必须搜索其他解决方案,但我不知道如何将其应用于我的代码上班。)
ask by Bad_Developer translate from so