Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail utils method in UIView (CLUViewRecordableAdditions) if arguments are invalid #6

Open
Geek-1001 opened this issue Apr 24, 2017 · 0 comments

Comments

@Geek-1001
Copy link
Owner

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.

Reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant