Skip to content

OnlineSmileDev/NSTimer-WeakTarget

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#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.

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 91.3%
  • Ruby 8.7%