I have a function that returns an NSDictionary named data. It contains 2 objects: a NSDictionary object with the key currency_data and an NSString object with the key time.
I want to pass :
- the string value with the key
timeto a newNSStringobject - the
NSDictionaryobject with the keycurrency_datato aNSMutableDictionaryvariable.
How can I do that?
Depending on whether you use ARC. With ARC your example should work, without ARC you need to retain at least the string values.
What anoop-vaidy meant is I think, if you need a mutable dictionary, create that in the data call directly and pass it out. Another note: You can use your knowledge of you data structure in a better way. Instead of building a dictionary with 2 keys, use the first value ( the time string) as the key and the second (the currency dict) as the value. You can access values and keys in dictionaries quite easily