What’s the cleanest way to copy an object from one NSDictionary to another? I have to extract specific values from a dictionary and store them in a new dictionary. Currently I have some simple code like so…
NSString *value1 = [dictA objectForKey:@"1"];
[dictB setObject:value1 forKey:@"1"];
…but it feels like it has more common code than I’d like. I have to do this many times and I’m wondering if there’s a cleaner way to do this.
Thanks in advance for your wisdom!
In modern Objective-C syntax you could actually write
dictA[@"key1"] = dictB[@"key1"]with mutable dictionaries.