-
Notifications
You must be signed in to change notification settings - Fork 395
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
keyPathsForValuesAffectingValueForKey code should have 'else' statements #98
Labels
Comments
You could also simply return in the if clause. It might be simpler to create a template. if ([key isEqualToString:@"angleXValue"]) { |
smic, of course! good idea! wolf, would you accept such a patch? |
Merged
ddrccw
pushed a commit
to ddrccw/mogenerator
that referenced
this issue
Jan 20, 2014
…tingValueForKey
ddrccw
pushed a commit
to ddrccw/mogenerator
that referenced
this issue
Jan 20, 2014
--- fixed issue rentzsch#98
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The code generated for the keyPathsForValuesAffectingValueForKey method ends up like this:
(NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key {
NSSet *keyPaths = [super keyPathsForValuesAffectingValueForKey:key];
if ([key isEqualToString:@"angleXValue"]) {
NSSet *affectingKey = [NSSet setWithObject:@"angleX"];
keyPaths = [keyPaths setByAddingObjectsFromSet:affectingKey];
}
if ([key isEqualToString:@"angleYValue"]) {
NSSet *affectingKey = [NSSet setWithObject:@"angleY"];
keyPaths = [keyPaths setByAddingObjectsFromSet:affectingKey];
}
return keyPaths;
}
Which is fine, but since we're always comparing the same 'key' and we never want to enter more than one 'if', it would be better that we had 'else' statements after the first 'if'.
It could give a small performance boost too, or certainly be no worse.
The text was updated successfully, but these errors were encountered: