這段代碼有什麼問題,我該如何解決這個問題? 請解釋你的答案,讓我可以學習。我對Swift很陌生,對編程也很新穎。Swift中的嵌套字典
var has: Dictionary<String, Dictionary<Dictionary, Int>> = [
"Material" : [
"Factory" : 0,
"Raw" : 0,
"Energy" : 0,
],
"Workers" : [
"Dev" : 0,
"Builder" : 0,
"Advertiser" : 0,
"Consultant" : 0,
"Engenier" : 0,
"QA" : 0,
],
"Assets" : [
"Bonds" : 0,
],
"Owe" : [
"10%" = 0,
"20%" = 0,
"30%" = 0
],
"Other" : [
"Insurance" : 0
]
]
剛一說明。您可以使用別名'[String:[String:Int]]'來表示字典的類型。更容易閱讀我認爲(並容易發現錯誤(字典)在你的類型字符串 – Fogmeister