/TWGCDTimer

TWGCDTimer is a timer encapsulated by GCD.

Primary LanguageObjective-CMIT LicenseMIT

TWGCDTimer

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

TWGCDTimer is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'TWGCDTimer'

Usage

self.timerTask = [TWGCDTimer execTaskBlock:^{
    
    if(self.timeout <= 0){
        /// 取消任务
        [TWGCDTimer cancelTask:self.timerTask];
        NSLog(@"timer停止计时");
        return;
    }
    
    if(self.timeout > 0){
        self.timeout--;
        NSLog(@"%zd", self.timeout);
    }
} start:0 interval:1 repeats:YES async:NO];

Author

tiltwang

License

TWGCDTimer is available under the MIT license. See the LICENSE file for more info.