Let's say I have a class Car
, with the following property scheme:
@interface Car : NSObject
@property int carID;
@property Driver *driver;
@property NSString *brandName;
...
@end
Now, I have a dictionary of Car
instances, and whenever I download a new instance from my server, I overwrite with carDictionary[@(newCar.carID)] = newCar;
to keep my instances updated. The only issue is that sometimes my instances are downloaded with some properties not filled out.
When I download a new instance, is there a way to only overwrite using the non-nil properties I download and leave the nil properties alone? Obviously, I could manually set each property, but I don't want to have to change this every time I add a new property.