-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
Description
We need to fail some utils method in UIView (CLUViewRecordableAdditions) if input arguments are invalid.
For example:
- (NSDictionary *)clue_fontPropertyDictionaryForFont:(UIFont *)font {
NSMutableDictionary *fontDictionary = [[NSMutableDictionary alloc] init];
if (font) {
[fontDictionary clue_setValidObject:font.familyName forKey:@"familyName"];
[fontDictionary clue_setValidObject:font.fontName forKey:@"fontName"];
[fontDictionary setObject:@(font.pointSize) forKey:@"pointSize"];
[fontDictionary setObject:@(font.lineHeight) forKey:@"lineHeight"];
}
return fontDictionary;
}If user will pass invalid font – this method will return empty dictionary. But if font is invalid, we don't need font dictionary at all.
Here are some utils method from UIView (CLUViewRecordableAdditions) which I think needs to be fixed (return nil if input argument is invalid)
-clue_fontPropertyDictionaryForFont:-clue_attributedTextPropertyDictionaryForAttributedString:-clue_colorPropertyDictionaryForColor:
Note : We need to check where those method used and ensure that we won't pass invalid object into dictionary for example.
Problem
We don't need empty dictionary if input argument is invalid.