Skip to content

Instantly share code, notes, and snippets.

@sdpjswl
Last active June 11, 2018 10:52
Show Gist options
  • Save sdpjswl/10f71a42506e02b91fc5 to your computer and use it in GitHub Desktop.
Save sdpjswl/10f71a42506e02b91fc5 to your computer and use it in GitHub Desktop.
Get a deep Mutable copy of NSArray and NSDictionary
+ (NSMutableDictionary *)deepMutableCopyOfDictionary:(NSDictionary *)dictionary
{
return (__bridge_transfer NSMutableDictionary *)CFPropertyListCreateDeepCopy(kCFAllocatorDefault, (__bridge CFDictionaryRef)dictionary, kCFPropertyListMutableContainers);
}
+ (NSMutableArray *)deepMutableCopyOfArray:(NSArray *)array
{
return (__bridge_transfer NSMutableArray *)CFPropertyListCreateDeepCopy(kCFAllocatorDefault, (__bridge CFArrayRef)array, kCFPropertyListMutableContainers);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment