A Swift library providing an elegant and readable timer interface as an alternative to NSTimer.
Each is a Swift library that provides a more elegant and readable interface for timers in iOS, macOS, tvOS, and watchOS applications. It serves as a bridge to NSTimer, simplifying timer management with a clean API to configure and control time-based operations. The library reduces boilerplate code and improves code clarity compared to using NSTimer directly.
Swift developers building applications for Apple platforms (iOS, macOS, tvOS, watchOS) who need to implement timers for scheduling repetitive tasks, animations, or time-based logic. It is particularly useful for developers seeking to avoid the verbosity and complexity of NSTimer.
Developers choose Each over NSTimer for its readable syntax, configurable time intervals (milliseconds to hours), and built-in methods to help manage memory leaks. Its extendable design and control operations like manual stopping and restarting offer a more intuitive and maintainable approach to timer management in Swift.
Elegant ⏱ interface for Swift apps
Syntax like Each(1).seconds.perform is more intuitive than NSTimer's verbose initialization, improving code clarity as shown in usage examples.
Supports intervals from milliseconds to hours, allowing precise configuration for various timer needs, per the features list.
Offers perform(on:) method to automatically handle timer lifecycle tied to an owner object, reducing leak risks as explained in the leaks section.
Provides stop() and restart() methods for direct timer management, giving developers fine-grained control over operations.
The library doesn't fully prevent leaks and requires manual workarounds like weak self checks or explicit stop calls, admitted in the leaks section.
As a wrapper over NSTimer, it inherits issues like run-loop dependency and lower precision for high-frequency tasks compared to DispatchQueue timers.
Installation relies on CocoaPods or Carthage, adding dependency management complexity without native Swift Package Manager support.
Syntactic sugar in Swift for asynchronous dispatches in Grand Central Dispatch
Schedule timing task in Swift using a fluent API. (A friendly alternative to Timer)
Swifty API for NSTimer
The ES8 Async/Await control flow for Swift
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.