Latest 1.1
Homepage https://github.com/YuAo/NSTimer-WeakTarget
License MIT
Platforms ios 7.0, requires ARC
Authors

NSTimer-WeakTarget

A NSTimer category which adds the support of weak target for NSTimer.

With this NSTimer category. You will NEVER worry about NSTimer retaining its target.

What’s included?

Tree methods.

Turn the target-action based NSTimer, to the weak target-action based NSTimer.

An NSTimer created with these methods will NOT retain its target, and the timer will automatically be invalidated after the target is disposed.

@interface NSTimer (WeakTarget)

- (id)initWithFireDate:(NSDate *)date
              interval:(NSTimeInterval)timeInterval
            weakTarget:(id)target
              selector:(SEL)selector
              userInfo:(id)userInfo
               repeats:(BOOL)repeats;

+ (NSTimer *)timerWithTimeInterval:(NSTimeInterval)timeInterval
                        weakTarget:(id)target
                          selector:(SEL)selector
                          userInfo:(id)userInfo
                           repeats:(BOOL)repeats;

+ (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)timeInterval
                                 weakTarget:(id)target
                                   selector:(SEL)selector
                                   userInfo:(id)userInfo
                                    repeats:(BOOL)repeats;

@end

Requirements

  • Automatic Reference Counting (ARC)
  • iOS 5.0+
  • Xcode 4.5+

Contributing

If you find a bug and know exactly how to fix it, please open a pull request.

If you can’t make the change yourself, please open an issue after making sure that one isn’t already logged.

License

The MIT license, as aways.

Latest podspec

{
    "name": "NSTimer+WeakTarget",
    "version": "1.1",
    "summary": "A NSTimer category which adds the support of weak target for NSTimer",
    "homepage": "https://github.com/YuAo/NSTimer-WeakTarget",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "YuAo": "[email protected]"
    },
    "requires_arc": true,
    "platforms": {
        "ios": "7.0"
    },
    "source_files": "NSTimer+WeakTarget/*.{h,m}",
    "source": {
        "git": "https://github.com/YuAo/NSTimer-WeakTarget.git",
        "tag": "1.1"
    },
    "module_name": "NSTimerWeakTarget"
}

Pin It on Pinterest

Share This