Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Swift
  3. Each

Each

MITSwift

A Swift library providing an elegant and readable timer interface as an alternative to NSTimer.

GitHubGitHub
750 stars29 forks0 contributors

What is Each?

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.

Target Audience

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.

Value Proposition

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.

Overview

Elegant ⏱ interface for Swift apps

Use Cases

Best For

  • Implementing countdown timers or stopwatch features in iOS apps with configurable time units.
  • Scheduling repetitive UI updates or animations in Swift-based macOS or tvOS applications.
  • Managing background tasks or periodic data synchronization in watchOS apps with clean timer APIs.
  • Reducing boilerplate and improving readability when replacing NSTimer usage in existing Swift projects.
  • Handling memory leaks in timer implementations using built-in methods like perform(on:) for automatic management.
  • Creating extendable timer logic for custom use cases in Apple platform development.

Not Ideal For

  • Applications requiring frame-perfect animations or sub-millisecond timer precision (e.g., real-time games using CADisplayLink)
  • Projects targeting non-Apple platforms or using non-Swift languages like Objective-C or Flutter
  • Teams heavily invested in Swift's modern concurrency (async/await) or Combine framework for reactive timer patterns

Pros & Cons

Pros

Clean Readable API

Syntax like Each(1).seconds.perform is more intuitive than NSTimer's verbose initialization, improving code clarity as shown in usage examples.

Flexible Time Units

Supports intervals from milliseconds to hours, allowing precise configuration for various timer needs, per the features list.

Built-in Memory Aid

Offers perform(on:) method to automatically handle timer lifecycle tied to an owner object, reducing leak risks as explained in the leaks section.

Manual Control Features

Provides stop() and restart() methods for direct timer management, giving developers fine-grained control over operations.

Cons

Memory Leak Complexity

The library doesn't fully prevent leaks and requires manual workarounds like weak self checks or explicit stop calls, admitted in the leaks section.

NSTimer Limitations Inherited

As a wrapper over NSTimer, it inherits issues like run-loop dependency and lower precision for high-frequency tasks compared to DispatchQueue timers.

Setup Overhead

Installation relies on CocoaPods or Carthage, adding dependency management complexity without native Swift Package Manager support.

Frequently Asked Questions

Quick Stats

Stars750
Forks29
Contributors0
Open Issues1
Last commit3 years ago
CreatedSince 2016

Tags

#ios#library#time-management#tvos#timer#watchos#swift#macos

Built With

S
Swift

Included in

Swift26.0k
Auto-fetched 1 day ago

Related Projects

AsyncAsync

Syntactic sugar in Swift for asynchronous dispatches in Grand Central Dispatch

Stars4,565
Forks312
Last commit2 years ago
ScheduleSchedule

Schedule timing task in Swift using a fluent API. (A friendly alternative to Timer)

Stars1,820
Forks114
Last commit1 month ago
SwiftyTimerSwiftyTimer

Swifty API for NSTimer

Stars1,235
Forks136
Last commit2 years ago
AwaitKitAwaitKit

The ES8 Async/Await control flow for Swift

Stars747
Forks53
Last commit4 years ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub