Arrays 如何对json数据进行排序并加载uitable view swift3?
如何加载我的json数据和加载uitable视图我尝试了很多时间,但没有找到结果。这是我的json树Arrays 如何对json数据进行排序并加载uitable view swift3?,arrays,json,swift,xcode,Arrays,Json,Swift,Xcode,如何加载我的json数据和加载uitable视图我尝试了很多时间,但没有找到结果。这是我的json树 [ { "id": 1, "name": "Leanne Graham", "username": "Bret", "email": "Sincere@april.biz", "address": { "street": "Kulas Light", "suite": "Apt. 556", "city": "Gwe
[
{
"id": 1,
"name": "Leanne Graham",
"username": "Bret",
"email": "Sincere@april.biz",
"address": {
"street": "Kulas Light",
"suite": "Apt. 556",
"city": "Gwenborough",
"zipcode": "92998-3874",
"geo": {
"lat": "-37.3159",
"lng": "81.1496"
}
},
"phone": "1-770-736-8031 x56442",
"website": "hildegard.org",
"company": {
"name": "Romaguera-Crona",
"catchPhrase": "Multi-layered client-server neural-net",
"bs": "harness real-time e-markets"
}
},
]
有人帮我吗?感谢advance将代码json转换为数组,然后尝试此代码
let sortedArray = sortArrayUsingKey(strKey: "id", unSortedArray:unsortarray)
func sortArrayUsingKey(strKey:String,unSortedArray:NSArray) ->NSArray {
var tempArray:NSMutableArray = NSMutableArray();
tempArray = unSortedArray.mutableCopy() as! NSMutableArray;
let descriptor = NSSortDescriptor(key: strKey, ascending: true);
tempArray.sort(using: [descriptor]);
return tempArray as NSArray;
}
您尝试的内容显示您的代码!你要做什么来显示你的代码