Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/samhann/Every.swift
A swift wrapper for NSTimer
https://github.com/samhann/Every.swift
Last synced: 14 days ago
JSON representation
A swift wrapper for NSTimer
- Host: GitHub
- URL: https://github.com/samhann/Every.swift
- Owner: samhann
- License: bsd-2-clause
- Created: 2016-01-05T11:22:05.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-05-12T07:10:18.000Z (over 8 years ago)
- Last Synced: 2024-10-19T15:15:07.838Z (25 days ago)
- Language: Swift
- Size: 36.1 KB
- Stars: 265
- Watchers: 14
- Forks: 15
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Every.Swift - A Convenient NSTimer Wrapper
## Usage
Provided that your class implement `TimerManageable` protocol you just do:```swift
self.every(3.seconds) {
print("hello")
return true
}
```Prints "hello" every 3 seconds.
Return `true` from the closure to continue , `false` to invalidate the timer.
Alternatively , you can use the following method to invalidate all timers of the receiver:
`self.clearTimers()`Normally you're are responsible of invalidating the timers you created. If the timer is not invalidated before the object it's been tied to it will be invalidated next time the timer is elapsed and before calling the `ElapsedHandler`.
## TODO :
- [x] Investigate automatic invalidation of timer if owner is Swift object.
- [x] Add a project and test target.
- [ ] Improve unit test coverage.
- [x] Support milliseconds.
- [ ] Embed in a framework.
- [ ] More representative example application.
- [ ] OS X support.
- [ ] Carthage support.
- [x] CocoaPod support.