https://github.com/simplisticated/eternal
The way to manage time in Swift.
https://github.com/simplisticated/eternal
Last synced: 11 months ago
JSON representation
The way to manage time in Swift.
- Host: GitHub
- URL: https://github.com/simplisticated/eternal
- Owner: simplisticated
- License: mit
- Created: 2015-11-10T20:02:19.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-10-05T11:57:08.000Z (over 8 years ago)
- Last Synced: 2025-05-08T17:03:58.323Z (11 months ago)
- Language: Swift
- Size: 62.5 KB
- Stars: 6
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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 9.0 and later
* Swift 4
## Usage
```swift
/*
* 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.