Latest 0.0.2
Homepage https://github.com/DarknessFall/NTTimer
License MIT
Platforms ios 7.0, requires ARC
Frameworks Foundation, UIKit
Authors

Create timer expediently with Objective-C.
It is based on GCD timer source.
You don’t need to call cancel or set it to nil when the timer’s holder will release, this is automatically.

Requirements

  • iOS 7.0 or later
  • Xcode 5 or later

How To Use

You must make a weakSelf when you want to use self in the block.

Create a repeating timer and start it:

#import "NTTimer.h"
...
__weak SomeObject *weakSelf = self;
self.timer = [NTTimer scheduleRepeatingWithInterval:1 queue:dispatch_get_main_queue() action:^{
    [weakSelf doSomething];
}];

Creating a disposable timer and start it:

#import "NTTimer.h"
...
__weak SomeObject *weakSelf = self;
self.timer = [NTTimer scheduleDisposableWithInterval:1 queue:dispatch_get_main_queue() action:^{
     [weakSelf doSomething];
}];

You can suspend, resume, cancel the timer:

//Suspend
[timer suspend];
//Resume
[timer resume];
//Cancel
[timer cancel];

Installation

There are two ways to use NTTimer.

  1. Cocopods.
  2. Download or clone the project.

    Cocopods

    You can add NTTimer by Cocoapods.
    Edit you pod file:

    platform :ios, '7.0'
    target "YourProjectName" do
    pod 'NTTimer', '~> 0.0.1'

    Download Or Clone

    Add the "NTTimer.h" file and "NTTimer.m" file to you project.

    Licenses

    All source code is licensed under the MIT License.

Latest podspec

{
    "name": "NTTimer",
    "version": "0.0.2",
    "summary": "Create timer expediently.",
    "description": "Create timer expediently, and you don't need to consider timer release.",
    "homepage": "https://github.com/DarknessFall/NTTimer",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Bruce Jackson": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/DarknessFall/NTTimer.git",
        "tag": "0.0.2"
    },
    "source_files": "NTTimer/NTTimer/*.{h,m}",
    "frameworks": [
        "Foundation",
        "UIKit"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This