I need to set a bunch of object attributes according to an NSDictionary
supplied via JSON from a remote server. I don't want to overwrite attributes that are not in the dictionary.
Since there lot of attributes, I have long series of statements that look like this:
if (dictionary[@"address_1"] != [NSNull null])
self.configuration.userAddress1 = dictionary[@"address_1"];
The keys in the dictionary are not identical to the names of the properties; there are two different systems that grew up separately that I'm trying to make work together.
Maybe I've been doing too much Ruby coding, but it seems like there should be a better idiom in Objective-C for doing this. Any ideas?