Last active
December 20, 2015 05:09
-
-
Save andrewsardone/6076443 to your computer and use it in GitHub Desktop.
I'm trying my hardest to make sure @cdzombak can't read this code.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context | |
{ | |
if (object == self && context == self.kvoContext) { | |
((void (^)(void)) @{ | |
@"addresses": ^{ self.peep.address = [self dictionaryForArrayOfValues:self.addresses]; }, | |
@"emails": ^{ self.peep.email = [self dictionaryForArrayOfValues:self.emails]; }, | |
}[keyPath] ?: ^{})(); | |
} | |
else if (object == self.peep && context == self.kvoContext) { | |
((void (^)(void)) @{ | |
@"address": ^{ | |
_addresses = [self arrayForDictionaryOfValues:self.peep.address | |
withBackupKey:NSLocalizedString(@"address", nil)]; | |
}, | |
@"email": ^{ | |
_emails = [self arrayForDictionaryOfValues:self.peep.email | |
withBackupKey:NSLocalizedString(@"email", nil)]; | |
}, | |
}[keyPath] ?: ^{})(); | |
} | |
else { | |
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment