CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.

Eternal 4.0

Eternal 4.0

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Oct 2017
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by Igor Matyushkin.




Eternal

At a Glance

The way to manage time in Swift.

How To Get Started

  • Copy content of Eternal folder to your project.

or

  • Use Eternal cocoapod

Requirements

  • iOS 9.0 and later
  • Xcode 8 and later

Note: For Swift 2.x use Eternal v1.1. For Swift 3.0 use Eternal v3.0.

Usage

/*
 * Create timer.
 */
let timer1 = ETTimer()


/*
 * Start timer with block.
 * On every call of block you will get number of ticks
 * and time interval which has gone from the start.
 */

timer1.startWithTimeInterval(1.0, repeats: true) { (timer, tickCount, timeIntervalSinceStart) -> Void in
    NSLog("Timer did tick %d times. %.0f seconds has gone from the launch.", tickCount, timeIntervalSinceStart)
}


/*
 * Example of timer which will tick one time only.
 */

timer1.startWithTimeInterval(1.0, repeats: false) { (timer, tickCount, timeIntervalSinceStart) -> Void in
    NSLog("Timer did tick")
}


/*
 * When you don't need timer to continue ticks,
 * call stop() method:
 */

timer1.stop()


/*
 * There's also a shortened form of timer creation:
 */

ETTimer.every(1.0) { (timer, tickCount, timeIntervalSinceStart) -> Void in
    // Do something every second
}


/*
 * Similar method for timer that will perform one time only:
 */

ETTimer.after(1.0) { (timer, tickCount, timeIntervalSinceStart) -> Void in
    // Do something one time
}

License

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