目标Dictionary:
addressBookDict: [string:[ZZWPersonGetAllMembersModel]]
解决方法:
// 将addressBookDict字典中的所有Key值进行排序: A~Z,,得到key值排序数组
nameKeys = Array(addressBookDict.keys).sorted()
// 将addressBookDict字典中的所有Value值根据key键值进行排序: A~Z,,得到[(key:string,Value:[ZZWPersonGetAllMembersModel])]值排序的新数组
var addressBkeys = addressBookDict.sorted(by: { (t1, t2) -> Bool in
return t1.0 < t2.0 ? true:false
})
//获取键值数组 [[ZZWPersonGetAllMembersModel]]
var personArray =[ZZWPersonGetAllMembersModel]
for (_,value) in addressBkeys {
personArray.append(value)
}
继续获得Dictionary 只要用key和value做一个初始化赋值即可