The project needs a big Dictionary, so I place it in anohher swift file that makes the codes look clean. But I got a "Expected declaration" error.
class AA{
var a:Dictionary<String,Array<String>> = [:]
a["a"] = ["aa", "aaa"] // error: Expected declaration
...
...
}
and I want to get it like this:
let aa = AA.a
By now, I have to add it in a func to get it.
class AA{
func getVar()->Dictionary<String,Array<String>>{
var a:Dictionary<String,Array<String>> = [:]
a["a"] = ["aa", "aaa"]
a["b"] = ["bb", "bbb"]
return a
}
}
Any simple way to solve this?
@dasblinkenlight your suggestion is get variable from another viewController, it's a little difference from mine.