相关疑难解决方法(0)

Swift:数组内的字典

数据:

[
    { firstName: "Foo", lastName: "Bar" },
    { firstName: "John", lastName: "Doe" }
]
Run Code Online (Sandbox Code Playgroud)

如何使用 swift 数组和字典拥有这种结构?该数据显示数组内的字典,对吧?所以我建议:

var persons:Array = [Dictionary<String, String>()]
Run Code Online (Sandbox Code Playgroud)

但这给了我错误:

Cannot convert the expressions type () to type Array<T>
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

swift swift-dictionary swift-array

1
推荐指数
1
解决办法
9998
查看次数

标签 统计

swift ×1

swift-array ×1

swift-dictionary ×1