Latest 0.0.1
Homepage https://github.com/PggMan/PGTimerDemo
License MIT
Platforms ios 6.0, osx 10.8, requires ARC
Authors

Cocoapods

$ pod search PGTimer

PGTimerDemo

一个适用于多线程的GCD定时器


#import "ViewController.h"
#import "PGTimer.h"
@interface ViewController ()
@property (nonatomic ,copy) NSString *task;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    // run timer
    self.task = [PGTimer execTask:self selector:@selector(linkTest) start:2.0 interval:1.0 repeate:YES async:YES];
}

- (void)linkTest{
    // working
    NSLog(@"%s - %@",__func__, [NSThread currentThread]);

}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    // cancel
    [PGTimer cancelTask:self.task];
}
@end

Latest podspec

{
    "name": "PGTimer",
    "version": "0.0.1",
    "platforms": {
        "ios": "6.0",
        "osx": "10.8"
    },
    "summary": "GCD Timer",
    "homepage": "https://github.com/PggMan/PGTimerDemo",
    "license": "MIT",
    "authors": {
        "PggMan": "[email protected]"
    },
    "source": {
        "git": "https://github.com/PggMan/PGTimerDemo.git",
        "tag": "0.0.1"
    },
    "source_files": "PGTimerDemo/PGTimer/*.{h,m}",
    "requires_arc": true
}

Pin It on Pinterest

Share This