I came across NSFrozenDictionary while debugging an app.
Shared index property declared as NSDictionary * sharedIndex = ...
What is it? How is it different from NSMutableDictionary?
It is an NSMutableDictionary
marked as immutable.
One case to get __NSFrozenDictionaryM
:
Have an array of mutable dictionaries:
NSArray *array = @[{NSMutableDictionary}, {NSMutableDictionary}, {NSMutableDictionary}]
Making a two-level-deep copy of it by:
NSArray *res = [[NSArray alloc] initWithArray:array copyItems:YES]
The resulting res
array contains immutable copies of NSMutableDictionaries in array
, which are of type __NSFrozenDictionaryM
. I guess this is an optimisation to avoid really copying all dictionaries in the original array.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With