I am trying to make a complex Swift Dictionary declaration similar to a JSON package. However, the compiler fights a tooth and a nail with me. Here is what I am trying to do:
var icons: [[Any:Any]] = [
"categories:":[
["cat2" : [
["name":"ImageName","type":"image"],
["name":"ImageName","type":"scroll","panel":panel1],
["name":"ImageName","type":"chooser","panel":[
["name":"ImageName"]]]
]
],
["cat2" : ["name":"ImageName"]],
["cat3" : ["name":"ImageName"]],
["cat4" : ["name":"ImageName"]],
["cat5" : ["name":"ImageName"]]
],
"size":["x":"128","y":"128"]
]
I am not sure how to announce this. As you can tell, I have the first element as a String and the following auxiliary elements as additional dictionaries.
I want to know the best method for these data structures in Swift.
Thanks in advance.
source
share