我有一个 NSArray,它有 10 个 NSDictionary 记录。 我需要将所有记录一一移动到 NSDictionary,就像我们在 Objective c 中使用
NSDictionary *dictName = [Array_name objectAtIndex:indexPath.row]
不知道在 Swift 4.0 中该怎么做。
最佳答案
这里有一些使用数组和字典的示例。始终使用文档作为您的指南。 Link
let arr = [["11":11,"12":12],["21":21,"22":22]]
let dic = arr[0]
let dic1 = arr.first
for item in arr {
let dic = item
}
关于 swift 4.0 : How do i move all the NSArray values to NSDictionary dynamically?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49854672/