Simple classes for efficiently handling events.
- iOS 13.0+
- tvOS 13.0+
- macOS 10.15+
- watchOS 6.0+
- Swift 5.0+
Simple classes for efficiently handling events. You can use the Debouncer and Throttler to handle events.
Swift Package Manager is a tool for managing the distribution of Swift code. Itโs integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.
To integrate EventLimiter
into your Xcode project using Swift Package Manager, add it to the dependencies value of your Package.swift:
dependencies: [
.package(url: "https://github.com/baekteun/EventLimiter.git", .upToNextMajor(from: "1.0.0"))
]
If you prefer not to use either of the aforementioned dependency managers, you can integrate EventLimiter into your project manually.
let debouncer = Debouncer(for: 0.3)
debouncer {
await self.search(keyword: keyword)
}
debouncer.cancel()
let throttler = Throttler(for: 1, latest: false)
throttler {
await self.reachedBottom()
}
throttler.cancel()