There are several posts on SO like this , and the only solution that seems to work is to manually delete and insert a property with the same index.
But this seems messy, and some reports indicate that in Xcode 7 it is possible to directly update dictionary properties if inside an array of dictionaries.
However, it does not work for the code below, generating a Cannot assign to immutable expression of type [String:AnyObject] .
// Class vars var userDict = [String:AnyObject]() var accounts = [[String:AnyObject]]() func setHistory(index: Int, history: [String]) { (userDict["accounts"] as! [[String:AnyObject]])[index]["history"]! = history (userDict["accounts"] as! [[String:AnyObject]])[index]["history"] = history userDict["accounts"][index]["history"] = history userDict["accounts"][index]["history"]! = history }
All four lines inside setHistory try to do the same, and all fail.
source share