I have a class extension looking like this:
#import <Cocoa/Cocoa.h>
@interface NSBezierPath (BezierTimerExtension)
@property (strong, nonatomic) NSTimer *timer;
@property (strong, nonatomic) NSColor *color;
- (void)startTimer;
- (void)stopTimer;
@end
#import "NSBezierPathWithTimer.h"
@implementation NSBezierPath (BezierTimerExtension)
- (void)startTimer {
if (self.timer != nil) {
[self.timer fire];
}
}
- (void)stopTimer {
if (self.timer != nil) {
[self.timer invalidate];
}
}
- (NSTimer *)timer {
return self.timer;
}
- (void)setTimer:(NSTimer *)newTimer {
_timer = newTimer;
}
- (NSColor *)color {
return self.color;
}
- (void)setColor:(NSColor *)newColor {
_color = newColor;
}
@end
The problems are the two setters. Because Xcode says, that he don't know what to do with _timer or _color. When I set the variable with self.timer or self.color, it will create a infinite loop. self->timer and self->color is not working too.
How can I set the property timer and the property color in the setter? Also the getter should not work, as I see now. But thats simply the same problem.
Thanks for the answers iComputerfreak