/ Time

A simple to use library that gets around a load of problems that arise when you start trying to do

A simple to use library that gets around a load of problems that arise when you start trying to do

GlobalTimer

A simple to use library that gets around a load of problems that arise when you start trying to do much inside 'loop'.

Example

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

Requirements

  • Xcode
  • Objective-C

Features

  • [x] start a loop with an event.
  • [x] pause a specific loop.
  • [x] active a specific loop.
  • [x] remove a specific loop.
  • [x] 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 )shard;

- (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;

:book: Usage

    [[GTimer shard] scheduledWith:@"first" timeInterval:2 repeat:YES block:^(NSDictionary *userinfo) {
        NSLog(@"๐Ÿ‡บ๐Ÿ‡ธ%@", userinfo[@"test"]);
    } userinfo:@{@"test": @"ok"}];
    
    [[GTimer shard] scheduledWith:@"second" timeInterval:5 repeat:YES block:^(NSDictionary *userinfo) {
        NSLog(@"๐ŸŒบ%@", userinfo[@"cnkcq"]);
    } userinfo:@{@"cnkcq": @"king"}];
    [[GTimer shard] scheduledWith:@"dog" timeInterval:5 repeat:YES block:^(NSDictionary *userinfo) {
        NSLog(@"๐Ÿถ%@", userinfo[@"dog"]);
    } userinfo:@{@"dog": @"ๆ—บ่ดข"}];
    [[GTimer shard] scheduledWith:@"fourth" timeInterval:10 repeat:YES block:^(NSDictionary *userinfo) {
        NSLog(@"๐Ÿฑ%@", userinfo[@"cat"]);
    } userinfo:@{@"cat": @"ๅ’ชๅ’ช"}];

    [[GTimer shard] pauseEventWith:@"dog"];
        NSLog(@"%@", [[GTimer shard] eventList]);
    [[GTimer shard] activeEventWith:@"dog"];
    [[GTimer shard] removeEventWith:@"fourth"];

Reprensent

ti

GitHub