Simple GCD-based timer based on NSTimer
Objective-C
Latest commit fdb2f4c Aug 10, 2012 @rnapier Cleanup code slightly.
Permalink
Failed to load latest commit information.
.idea Add -fire method. May 30, 2012
RNTimer.xcodeproj Cleanup code slightly. Aug 10, 2012
RNTimer Cleanup code slightly. Aug 10, 2012
RNTimerTests
.gitignore Update doc settings May 30, 2012
AppledocSettings.plist Update doc settings May 30, 2012
README.md Update README May 30, 2012

README.md

RNTimer

Simple GCD-based timer based on NSTimer. It starts immediately and stops when released. This avoids many of the typical problems with NSTimer:

  • RNTimer runs in all modes (unlike NSTimer)
  • RNTimer runs when there is no runloop (unlike NSTimer)
  • Repeating RNTimers can easily avoid retain loops (unlike NSTimer)

Currently there is only a simple repeating timer (since this is the most common use that's hard to do correctly with NSTimer). It always runs on the main queue.

USAGE

__weak id weakSelf = self;
self.timer =
    [RNTimer repeatingTimerWithTimeInterval:1
                                      block:^{
                                        [weakSelf doSomething];
                                      }];

BACKGROUND

http://robnapier.net/blog/simple-gcd-timer-rntimer-762