Need help with RNTimer?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

rnapier
126 Stars 24 Forks 13 Commits 1 Opened issues

Description

Simple GCD-based timer based on NSTimer

Services available

!
?

Need anything else?

Contributors list

# 35,605
Swift
Shell
zig
functio...
13 commits

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

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.