如何声明以下多维数组的数据类型
settings = [
“person" : [
“name”:"bing",
"status”:"done",
],
“flags" : [
“moved" :true
]
]
尝试使用var settings = [String]()
,var settings = [String[String:String]
但无效
答案 0 :(得分:1)
纠正所有小错误后(您使用“
代替"
)
let settings = ["person": ["name": "bing", "status": "done"], "flags": ["moved": true]]
Alt点击设置显示:
let settings: [String : Dictionary<String, NSObject>]
但您也可以将其声明为[String: [String: AnyObject]]