NSTimer(GCKAdditions) Category

  • The NSTimer(GCKAdditions) category adds useful enhancements to NSTimer.

  • It includes a class method, gck_scheduledTimerWithTimeInterval:weakTarget:selector:userInfo:repeats:, that constructs an NSTimer with a weak target.

  • Using a weak target avoids a retain loop between the timer and its target.

  • The timer is automatically invalidated if its target is released when the timer fires.

NSTimer(GCKAdditions) Category Reference

Overview

A category on NSTimer that adds some useful enhancements.

Class Method Summary

(NSTimer *) + gck_scheduledTimerWithTimeInterval:weakTarget:selector:userInfo:repeats:
 Constructs an NSTimer with a weak target. More...
 

Method Detail

+ (NSTimer *) gck_scheduledTimerWithTimeInterval: (NSTimeInterval)  interval
weakTarget: (id)  target
selector: (SEL)  selector
userInfo: (nullable id)  userInfo
repeats: (BOOL)  repeats 

Constructs an NSTimer with a weak target.

Avoids a retain loop between the timer and its target. The timer will be automatically invalidated if the target has been released when the timer fires.