Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/baekteun/eventlimiter
π Simple classes for efficiently handling events based on a Swift Concurrency.
https://github.com/baekteun/eventlimiter
async-await debounce swift-concurrency throttle
Last synced: 3 months ago
JSON representation
π Simple classes for efficiently handling events based on a Swift Concurrency.
- Host: GitHub
- URL: https://github.com/baekteun/eventlimiter
- Owner: baekteun
- Created: 2023-06-19T02:13:07.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-12-03T14:31:59.000Z (about 1 year ago)
- Last Synced: 2023-12-03T15:27:25.237Z (about 1 year ago)
- Topics: async-await, debounce, swift-concurrency, throttle
- Language: Swift
- Homepage: https://baekteun.github.io/EventLimiter/documentation/eventlimiter/
- Size: 278 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# EventLimiter
Simple classes for efficiently handling events.
[Document](https://baekteun.github.io/EventLimiter/documentation/eventlimiter/)
## Contents
- [EventLimiter](#eventlimiter)
- [Contents](#contents)
- [Requirements](#requirements)
- [Overview](#overview)
- [Installation](#installation)
- [Swift Package Manager](#swift-package-manager)
- [Manually](#manually)
- [Usage](#usage)
- [QuickStart](#quickstart)## Requirements
- iOS 13.0+
- tvOS 13.0+
- macOS 10.15+
- watchOS 6.0+
- Swift 5.0+## Overview
Simple classes for efficiently handling events.
You can use the Debouncer and Throttler to handle events.## Installation
### Swift Package Manager
[Swift Package Manager](https://www.swift.org/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:
```swift
dependencies: [
.package(url: "https://github.com/baekteun/EventLimiter.git", .upToNextMajor(from: "1.0.0"))
]
```### Manually
If you prefer not to use either of the aforementioned dependency managers, you can integrate EventLimiter into your project manually.
## Usage
### QuickStart
```swift
let debouncer = Debouncer(for: 0.3)
debouncer {
await self.search(keyword: keyword)
}
debouncer.cancel()
``````swift
let throttler = Throttler(for: 1, latest: false)
throttler {
await self.reachedBottom()
}
throttler.cancel()
```