I probably missed an important information about swift. I have a map contains a key / swift array pair. I changed the array and the array inside the map was not changed. Cou
As you've been told, these (dictionaries and arrays) are value types. So in general the technique you're looking for is simply to take the array out of the dictionary, modify it, and put it back in again:
var map = [String:[String]]()
map["list"] = [String]()
var list = map["list"]!
list.append("test")
map["list"] = list
However, there's another way: you can get a sort of pointer to the array inside the dictionary, but only if you use a function with an inout parameter. For example:
var map = [String:[String]]()
map["list"] = [String]()
func append(s : String, inout to arr : [String]) {
arr += [s]
}
append("test", to: &(map["list"]!))
That's actually just a notation for the same thing, but if you're going to do a lot of this you might prefer it.