A thread safe throttle written in Swift

Overview

SwiftThrottle

A thread safe throttle written in Swift licensed under MIT.

Introduction

This throttle is intended to prevent the program from crashing with too many requests or is used for saving computer resources.

Swift Throttle is not designed for operations that require high time accuracy

Examples

I need a throttle that executes my code at most once per second, in the main thread.

let throttle = Throttle(minimumDelay: 1)
throttle.throttle { 
    print("it's default to main thread")
}

I need a throttle that executes my code at most once per hour, in some background thread.

let throttle = Throttle(minimumDelay: 3600, queue: .global())
throttle.throttle { 
    print("will async to global thread")
}

2021-07-04

Copyright © 2021 Lakr Aream. All rights reserved.

You might also like...
A compiler with very basic capabilities written in Swift

BasicCompiler A compiler with very basic capabilities written in Swift. This project is not intended for real-world use; it's implemented just for fun

AuroraEditor is a IDE built by the community, for the community, and written in Swift for the best native performance and feel for macOS.
AuroraEditor is a IDE built by the community, for the community, and written in Swift for the best native performance and feel for macOS.

AuroraEditor AuroraEditor is a IDE built by the community, for the community, and written in Swift for the best native performance and feel for macOS.

Owl is a portable Wayland compositor written in Objective-C, using Cocoa as its backend.

Owl is a portable Wayland compositor written in Objective-C, using Cocoa as its backend. Owl primarily targets Mac OS X, but also supports a varie

iOS's Stocks App clone written in React Native for demo purpose (available both iOS and Android).
iOS's Stocks App clone written in React Native for demo purpose (available both iOS and Android).

FinanceReactNative iOS's Stocks App clone written in React Native for demo purpose (available both iOS and Android). Data is pulled from Yahoo Finance

A simple To Do application written in React Native

Example To Do List application in react-native Requirements, install as needed: React Native: $ npm i -g react-native-cli watchman: $ brew install wa

A property finder application written using React Native

React Native PropertyFinder App This repository accompanies the tutorial I published on Ray Wenderlich's website, which describes the process of build

The Bitwarden mobile application is written in C# with Xamarin Android, Xamarin iOS, and Xamarin Forms.
The Bitwarden mobile application is written in C# with Xamarin Android, Xamarin iOS, and Xamarin Forms.

Bitwarden Mobile Application The Bitwarden mobile application is written in C# with Xamarin Android, Xamarin iOS, and Xamarin Forms. Build/Run Require

A Hacker News client written in React Native
A Hacker News client written in React Native

React Native Hacker News A modern cross-platform HackerNews client built on React Native Features The app currently has the following functionality: H

Cross-platform instrumentation and introspection library written in C

Gum Cross-platform instrumentation and introspection library written in C. This library is consumed by frida-core through its JavaScript bindings, Gum

Releases(1.0.2)
Owner
Lakr Aream
¿
Lakr Aream
Wasmic allows you to run WebAssembly in a safe way on iOS.

wasmic-ios Bootstrap $ git clone https://github.com/kateinoigakukun/wasmic-ios.git $ git -c submodule."fastlane".update=none submodule update --init -

Yuta Saito 58 Dec 12, 2022
Are you sure the chemical compounds of your daily use are 100% safe? Use Chem-Aware, identify them right now!

View Project On Devpost: Built With: PubChem's REST API How To Install Chem Aware: Prerequiste: Latest Version of Xcode and Simulators installed The a

Jerry Zhang 5 Aug 23, 2022
Delightful code generation for OpenAPI specs for Swift written in Swift

Create API Delightful code generation for OpenAPI specs for Swift written in Swi

Alexander Grebenyuk 286 Dec 23, 2022
This project is a minimalistic Pomodoro timer for OS X written in Swift

Minimalistic Pomodoro for OSX This project is a minimalistic Pomodoro timer for OS X written in Swift started by @bengsfort, and substantially enhance

Kushal Shingote 2 Nov 17, 2021
An interpreter for Lox written in Swift.

slox An interpreter for Lox written in Swift. Provided for with an MIT License.

Manuel Werder 1 Nov 8, 2021
NetFun-Backend - BFF layer (written in Swift)

NetFun-Backend BFF layer (written in Swift). One can setup BFF using Core Classess (which is already added as a dependency of this package. See Packag

Minhaz Panara 0 Jan 3, 2022
KnockToReact is an iOS library written in Swift and Objective-C that brings an exclusive feature to interact with users just by receiving and recognizing "knocks" in the device.

KnockToReact is an iOS library written in Swift and Objective-C that brings an exclusive feature to interact with users just by receiving and recognizing "knocks" in the device.

Matheus Cavalca 25 Feb 10, 2022
A usermanager written in swift 3.0 saves you from hassle of saving your active user session.

SwiftUserManager A usermanager written in swift 3.0 saves you from hassle of saving your active user session. Call api and give the json to MOProfile

Zeeshan Haider 22 Sep 30, 2022
IBSKit - an Xcode Fat Framework written in Swift 5

IBSKit framework is designed to solve everyday tasks that any iOS developer faces when developing a new project.

IBS Mobile iOS 9 Nov 11, 2022
TTipBoxView is a simple and flexible UI component fully written in Swift

TTipBoxView is a simple and flexible UI component fully written in Swift. It is developed to help you create a hint/prompt view quickly, saving your time and avoiding having to write many lines of codes.

Nguyen Duc Thinh 3 Aug 18, 2022