- Core Foundation
CFMutableDictionary manages dynamic dictionaries. The basic interface for managing dictionaries is provided by CFDictionary. CFMutableDictionary adds functions to modify the contents of a dictionary.
You create a mutable dictionary object using either the
CFDictionary function. You can add key-value pairs using the
CFDictionary functions. When adding key-value pairs to a dictionary, the keys and values are not copied—they are retained so they are not invalidated before the dictionary is deallocated. You can remove key-value pairs using the
CFDictionary function. When removing key-value pairs from a dictionary, the keys and values are released.
CFMutableDictionary is “toll-free bridged” with its Cocoa Foundation counterpart,
NSMutable. What this means is that the Core Foundation type is interchangeable in function or method calls with the bridged Foundation object. This means that in a method where you see an
NSMutable parameter, you can pass in a
CFMutable, and in a function where you see a
CFMutable parameter, you can pass in an NSMutableDictionary instance. This also applies to concrete subclasses of NSMutableDictionary. See Toll-Free Bridged Types for more information on toll-free bridging.