NSTimer as a self-targeting ivar.
- by Matt Wilding
I have come across an awkward situation where I would like to have a class with an NSTimer instance variable that repeatedly calls a method of the class as long as the class is alive. For illustration purposes, it might look like this:
// .h
@interface MyClock : NSObject {
NSTimer* _myTimer;
}
- (void)timerTick;
@end
-
// .m
@implementation…