I have a model class object which has the following properties
@property (nonatomic, strong) NSString *place;
@property (nonatomic, strong) NSString *date;
I am setting these properties from a controller class object.
I want to perform a null check of my model class object properties. So I want to write a for loop like following.
for (property in modelObject)
{
if (object == [NSNull null])//object is a property of modelobject
{
//the next two lines wont be true but need to check that
if([property isKindOfClass:[NSString Class]]) property = @"no place";
if([property isKindOfClass:[NSDate Class]]) property = @"No date;
}
}
My question is,
If the model class object property is set to null how can I check if the property is null and also the declaration type of that property?
Directly checking the two properties instead of looping through the properties won't be helpful because in the actual scenario there are lot of properties with different types for the model class.
Thanks in advance.