Skip to content

Instantly share code, notes, and snippets.

@dezinezync
Created March 1, 2015 12:08
Show Gist options
  • Select an option

  • Save dezinezync/2ad1c6d7c3e69c3e737e to your computer and use it in GitHub Desktop.

Select an option

Save dezinezync/2ad1c6d7c3e69c3e737e to your computer and use it in GitHub Desktop.
NSDictionary (Changes)
@implementation NSDictionary (Changes)
- (NSDictionary *)changedKeysIn:(NSDictionary*)d
{
NSMutableDictionary *changedKeys = @{}.mutableCopy;
for(id k in self)
{
id val = [d objectForKey:k];
if(![[self objectForKey:k] isEqual:val])
{
[changedKeys setObject:val?:[NSNull null] forKey:k];
}
}
return [changedKeys copy];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment