Skip to content
⌛️ Grand Central Dispatch Utilities
Swift Objective-C Ruby
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Chronos.xcodeproj Update to Swift 3.0 Sep 17, 2016
Chronos.xcworkspace Changed scheme containers to project Feb 21, 2016
Chronos
ChronosTests fix app crash and update unit tests Dec 20, 2016
.gitignore Refactored and documented Apr 5, 2015
.swift-version Added .swift-version file for Cocoa Pods publishing Sep 18, 2016
.travis.yml update travis.yml Sep 17, 2016
Chronos-Swift.podspec v0.3.0 Sep 17, 2016
LICENSE Update LICENSE Apr 5, 2015
README.md Update README.md Dec 21, 2016
header.png added header May 23, 2015

README.md

Overview

Build Status Version Carthage compatible Platform License git-brag-stats

Chronos is a collection of useful Grand Central Dispatch utilities. If you have any specific requests or ideas for new utilities, don't hesitate to create a new issue.

Utilities

  • DispatchTimer - A repeating timer that fires according to a static interval, e.g. "Fire every 5 seconds".
  • VariableTimer - A repeating timer that allows you to vary the interval between firings, e.g. "Fire according to the function interval = 2 * count."

Usage

Quick Start

CocoaPods

Add the following to your Podfile:

pod 'Chronos-Swift'
Carthage

Add the following to your Cartfile:

github "comyarzaheri/Chronos-Swift" "master"

Using a Dispatch Timer

import Chronos

var timer = DispatchTimer(interval: 0.25, closure: {
            (timer: RepeatingTimer, count: Int) in
                println("Execute repeating task here")
            })

/** Starting the timer */
timer.start(true) // Fires timer immediately

/** Pausing the timer */
timer.pause()

/** Permanently canceling the timer */
timer.cancel()

Using a Variable Timer

import Chronos

var variableTimer: VariableTimer = VariableTimer(closure: { 
            (timer: RepeatingTimer, count: Int) -> Void in
                println("Execute repeating task here")
        }) {(timer: VariableTimer, count: Int) -> Double in
                return Double(2 * count) // Return interval according to function
        }

/** Starting the timer */
timer.start(true) // Fires timer immediately

/** Pausing the timer */
timer.pause()

/** Permanently canceling the timer */
timer.cancel()

Requirements

  • iOS 8.0 or higher
  • OS X 10.10 or higher

License

Chronos is available under the MIT License.

Contributors

You can’t perform that action at this time.