Is it redundant to check isKindOfClass even for non id variables in Objective C?
Teammate wrote Swift code. I am reviewing. Do I really need to check with isKindOfClass
in the condition or its redundant?
-(void) checkCalorie:(NSMutableDictionary *) update {
NSString *foodInfoId = [update objectForKey:FOOD_INFO_ID];
double calorie = [[update objectForKey:CALORIE] doubleValue];
if ([foodInfoId isKindOfClass:[NSString class]] && calorie < 0)
{
calorie = 0.0;
// some logic
}
}