Every.swift
A swift wrapper for NSTimer
Install / Use
/learn @samhann/Every.swiftREADME
Every.Swift - A Convenient NSTimer Wrapper
Usage
Provided that your class implement TimerManageable protocol you just do:
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.
Related Skills
node-connect
340.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
340.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
84.2kCommit, push, and open a PR
