How can I convert an NSDictionary to an NSMutableDictionary?
In case of Swift
var tempDic: NSMutableDictionary = yourDictionary.mutableCopy() as NSMutableDictionary
Use -mutableCopy
.
NSDictionary *d;
NSMutableDictionary *m = [d mutableCopy];
Note that -mutableCopy
returns id
(Any
in Swift) so you will want to assign / cast to the right type. It creates a shallow copy of the original dictionary.