I have
NSMutableDictionary *myDictionary = [[NSMutableDictionary alloc] init];
id dict = [myDictionary copy];
but is dict
now just a regular NSDictionary
? Or is it a copy of the NSMutableDictionary
?
Also, is there any way to go from mutable to non-mutable?
There are two methods involved here; -copy
and -mutableCopy
.
If the class holds a distinction; -copy
always creates an immutable copy; and -mutableCopy
always creates a mutable copy.
If the class holds no distinction; -copy
always creates a true copy.
So yes, dict is now an NSDictionary, containing the objects in the dictionary.