GlobalTimer
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
Requirements
- Xcode
- Objective-C
Features
- start a loop with an event.
- pause a specific loop.
- active a specific loop.
- remove a specific loop.
- update a loop with a new interval
Installation
GlobalTimer is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'GlobalTimer'
Api
+ (instancetype _Nonnull )shared;
- (void)scheduledWith: (NSString * _Nonnull )identifirer timeInterval: (NSTimeInterval)interval repeat:(BOOL)repeat block:(GTBlock _Nonnull )block userinfo:(NSDictionary * _Nullable)userinfo;
- (void)updateEventWith: (NSString * _Nonnull )identifirer timeInterval: (NSTimeInterval)interval repeat:(BOOL)repeat block:(GTBlock _Nonnull )block userinfo:(NSDictionary * _Nullable)userinfo;
- (void)pauseEventWith: (NSString *_Nonnull)identifirer;
- (void)removeEventWith: (NSString *_Nonnull)identifirer;
- (void)activeEventWith:(NSString *_Nonnull)identifirer;
- (NSArray<NSString *> *_Nonnull)eventList;
π Usage
[[GTimer shared] scheduledWith:@"first" timeInterval:2 repeat:YES block:^(NSDictionary *userinfo) {
NSLog(@"πΊπΈ%@", userinfo[@"test"]);
} userinfo:@{@"test": @"ok"}];
[[GTimer shared] scheduledWith:@"second" timeInterval:5 repeat:YES block:^(NSDictionary *userinfo) {
NSLog(@"πΊ%@", userinfo[@"cnkcq"]);
} userinfo:@{@"cnkcq": @"king"}];
[[GTimer shared] scheduledWith:@"dog" timeInterval:5 repeat:YES block:^(NSDictionary *userinfo) {
NSLog(@"πΆ%@", userinfo[@"dog"]);
} userinfo:@{@"dog": @"ζΊθ΄’"}];
[[GTimer shared] scheduledWith:@"fourth" timeInterval:10 repeat:YES block:^(NSDictionary *userinfo) {
NSLog(@"π±%@", userinfo[@"cat"]);
} userinfo:@{@"cat": @"εͺεͺ"}];
[[GTimer shared] pauseEventWith:@"dog"];
NSLog(@"%@", [[GTimer shared] eventList]);
[[GTimer shared] activeEventWith:@"dog"];
[[GTimer shared] removeEventWith:@"fourth"];
Reprensent
Author
[email protected], [email protected]
License
GlobalTimer is available under the MIT license. See the LICENSE file for more info.