swift 4.0 : How do i move all the NSArray values to NSDictionary dynamically?

标签 swift swift3 nsarray swift4

我有一个 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/

相关文章:

image - NSArray泄漏了很多图像

iphone - NSManagedObject 层次结构导入和导出

iphone - 防止重复的 NSArray(一个已排序,一个未排序)

swift - XCTKVOExpectation 超时,即使元素存在

ios - Swift 中 'k' 和 'v' 之间的枚举值有什么区别?

ios - 在对 tableView 约束进行动画处理时,TableViewCells 最初的大小错误

swift - Firebase 数据库通知

ios - 在 ViewController 上显示 SVProgressHUD?

ios - sectionForSectionIndexTitle 和 sectionIndexTitlesForTableView 未在 swift 3 中调用

ios - 无法构建 Objective c 模块