Skip to content

Commit

Permalink
Fix issue with property values being associated with the class not th…
Browse files Browse the repository at this point in the history
…e instance.
  • Loading branch information
John McKerrell committed Sep 14, 2015
1 parent 6a6fde7 commit 2ea64a4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions DZLCategoryProperties/NSObject+DZLCategoryProperties.m
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ + (void)implementGetterIfNecessaryForPropertyName:(char const *)propertyName cus
{
SEL getter = NSSelectorFromString(customGetterName ?: [NSString stringWithFormat:@"%s", propertyName]);
[self implementMethodIfNecessaryForSelector:getter parameterTypes:NULL block:^id(id _self) {
return objc_getAssociatedObject(self, key);
return objc_getAssociatedObject(_self, key);
}];
}

Expand All @@ -137,7 +137,7 @@ + (void)implementSetterIfNecessaryForPropertyName:(char const *)propertyName cus

SEL setter = NSSelectorFromString(customSetterName ?: [NSString stringWithFormat:@"set%c%s:", toupper(*propertyName), propertyName + 1]);
[self implementMethodIfNecessaryForSelector:setter parameterTypes:"@" block:^(id _self, id var) {
objc_setAssociatedObject(self, key, var, associationPolicy);
objc_setAssociatedObject(_self, key, var, associationPolicy);
}];
}

Expand Down

0 comments on commit 2ea64a4

Please sign in to comment.