Ok, so say I have a property on a class:
@interface MyObject : NSObject {
MyOtherObject *someOtherObject;
}
@property (nonatomic, copy) MyOtherObject *someOtherObject;
@end
I'm trying to create something to deserialize an API response into the correct objects without explicitly defining what class each api attribute maps to. So, is there any way for me to find out what class a property is, even if it's nil
? What I'm looking for is some method like [MyObject classForProperty:@"someOtherObject"]
which would return a Class
object. Note--I'm not looking for isKindOfClass:
or just class
, as those won't work on a nil
value.
Worst case, I can just manually define a list of property classes, but it'd be really nice if there were some built in way to do it.