I have a category on a class I made, and that category conforms to a protocol, which requires a property in its implementation. However, because I'm in a category, I cannot synthesize the property in the implementation of the category. Because of this, I'm stumped on how to implement the setter method (when I keep the protocol's property readonly it works fine, since all I need is an accessor method).
This is my protocol:
@protocol SomeProtocol <NSObject>
@property (nonatomic) BOOL didDisplayRecommendation;
@end
I know if I do this I'll get an infinite loop:
- (void)setDidDisplayRecommendation:(BOOL)didDisplayRecommendation
{
self.didDisplayRecommendation = didDisplayRecommendation;
}
But when I try this I get a compiler error:
- (void)setDidDisplayRecommendation:(BOOL)didDisplayRecommendation
{
_didDisplayRecommendation = didDisplayRecommendation;
}
Note that didDisplayRecommendation is the property in the protocol. What's the best way of getting around this? Thanks in advance!