我有一个私人BOOL一类为什么我无法直接访问BOOL:_myBool?
@property (nonatomic, assign) BOOL myBool;
我想覆盖getter和setter,所以我可以进行同步,或将其分派到一个串行队列。
- (BOOL)myBool
{
__block BOOL test = NO;
dispatch_sync(self.shouldShowBannerQueue, ^{
test = _myBool; //This does not work. I get an error "Use of undeclared _myBool"
});
return test;
}
由于同样的原因,我无法重写setter。我无法直接访问_myBool。
为什么这个标记为[[swift]'? – Alexander