为类别生成属性
@property (nonatomic, assign) BOOL categoryBoolProperty;
此属性不受支持,因为它是 BOOL 类型
@interface FTGClassA : NSObject
@property (nonatomic, strong) NSNumber *strongProperty;
@end
此属性不受支持,因为它不在类别中,它将被自动合成以具有 getter、setter 和备份实例变量。
@property (nonatomic, copy, setter = updateCategoryCopyProperty:) NSString *categoryCopyProperty;
@property (nonatomic, strong) NSNumber *categoryStrongProperty;
这将选择 OBJC_ASSOCIATION_RETAIN_NONATOMIC
@dynamic
来抑制警告NSArray *kClassAProperties = [FTGPropertyMaestro propertiesForClass:[FTGClassA class]];
FTGProperty *wheelNumberProperty = [FTGPropertyMaestro propertyForClass:[FTGCar class]
propertyName:@"wheelNumber"];
```
Synthesize property for category
--
`FTGClassA+FTGAdditions.h`
@interface FTGClassA (FTGAdditions)
@property (nonatomic, assign, getter = fetchCategoryBoolProperty) BOOL categoryBoolProperty; @property (nonatomic, strong) NSNumber *categoryStrongProperty; @property (nonatomic, copy, setter = updateCategoryCopyProperty :) NSString *categoryCopyProperty;
@end
`FTGClassA+FTGAdditions.m`
@implementation FTGClassA (FTGAdditions)
@dynamic categoryBoolProperty; @dynamic categoryCopyProperty; @dynamic categoryStrongProperty;
@end
Testing
--
Use XCTest
License
--
This project is released under the MIT license. See LICENSE.md