You should initialize the NSMutableDictionary using it's dictionary initializer, here's a quick example in Playground
let myDict:NSDictionary = ["a":1,"b":2]
let myMutableDict: NSMutableDictionary = NSMutableDictionary(dictionary: myDict)
myMutableDict["c"] = 3
myMutableDict["a"] // 1
myMutableDict["b"] // 2
myMutableDict["c"] // 3
Alternatively, you can declare a Swift dictionary as a var and mutate it whenever you want.
var swiftDictioanry : [String:AnyObject] = ["key":"value","key2":2]
The AnyObject value type mimics the behavior of an NSDictionary, if all types are known it can be declared like so:
var myNewSwiftDict : [String:String] = ["key":"value","nextKey":"nextValue"]
Dictionary
type withvar.
Dictionary
is value type by default so it does make a copy.