ibireme / YYCategories

A set of useful categories for Foundation and UIKit.
MIT License
826 stars 218 forks source link

YYSYNTH_DYNAMIC_PROPERTY_CTYPE的getter返回值类型错误 #53

Open dev-zlcode opened 6 years ago

dev-zlcode commented 6 years ago
#ifndef YYSYNTH_DYNAMIC_PROPERTY_CTYPE
#define YYSYNTH_DYNAMIC_PROPERTY_CTYPE(_getter_, _setter_, _type_) \
- (void)_setter_ : (_type_)object { \
    [self willChangeValueForKey:@#_getter_]; \
    NSValue *value = [NSValue value:&object withObjCType:@encode(_type_)]; \
    objc_setAssociatedObject(self, _cmd, value, OBJC_ASSOCIATION_RETAIN); \
    [self didChangeValueForKey:@#_getter_]; \
} \
- (type)_getter_ { \
    _type_ cValue = { 0 }; \
    NSValue *value = objc_getAssociatedObject(self, @selector(_setter_:)); \
    [value getValue:&cValue]; \
    return cValue; \
}
#endif

_getter_的返回值应该是_type_
rollingstoneW commented 6 years ago

把(type)getter改成(type)_getter_就好了