Joeyqiushi / JX_GCDTimer

NSTimer like tool implemented using GCD.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JX_GCDTimerManager

JX_GCDTimerManager is a NSTimer like tool implemented using GCD.

Usage

  1. Add the source files JX_GCDTimerManager.h and JX_GCDTimerManager.m to your Xcode project.
  2. Import JX_GCDTimerManager.h .
  3. Use in you code.
__weak typeof(self) weakSelf = self;
[[JX_GCDTimerManager sharedInstance] scheduledDispatchTimerWithName:@"myTime_hash"
                                                       timeInterval:2.0
                                                              queue:dispatch_get_main_queue()
                                                            repeats:NO
                                                      fireInstantly:NO
                                                             action:^{
                                                                 [weakSelf doSomething];
                                                             }];

You can add or remove functions as you need.

Requirements

This component requires iOS 8.0+.

Notice

If you are using JX_GCDTimerManager as a singleton, you should watch out that timer with the same name could interfere each other, as the name is the unique key of the timer. Make sure to use unique names for timer instances.

License

JX_GCDTimerManager is provided under the MIT license. See LICENSE file for details.

About

NSTimer like tool implemented using GCD.

License:MIT License


Languages

Language:Objective-C 100.0%