GitXplorerGitXplorer
c

Slow

public
1 stars
2 forks
0 issues

Commits

List of commits on branch master.
Unverified
2f9302b7cc4fb20d7c243a2c7df09bc60d1c3b81

merge upstream changes

ccoryalder committed 8 years ago
Unverified
f90841b27a0405eb2620555f8dfa30fdaf90adb0

Migrated to Swift 3

ccoryalder committed 8 years ago
Unverified
1ac5a8c5452ef31b378bd4f5ffb48d4274af61d1

Merge pull request #1 from adamyanalunas/run_on_user_queue

ccoryalder committed 9 years ago
Unverified
926d89fad9761d692f9d4dbd008d4c488ffd38d4

Fix events to run on user-specified queue

aadamyanalunas committed 9 years ago
Unverified
ca4daae7542589c5f330c242fe5f3a99f701a314

First commit

ccoryalder committed 9 years ago

README

The README file for this repository.

Slow - Swift Rate Limiting

Easy rate limiting perfect for live search or autocomplete. The first call starts a timer, subsequent calls cancel the previous closure and starts a new timer.

Usage

import Slow

let slow = Slow(interval: 0.25)

// you can now call slow.run as much as you 
for i in 0...5 {
    slow.run {
        print("\(i)")
    }
}

// only the final print (5) will run.

You can also init with a specific dispatch queue if you'd like your closures to run on that queue. Slow defaults to the main queue.

let slow = Slow(interval: 0.25, queue: dispatch_get_main_queue())

Installation

Swift Package Manager

Add Later to your Package.swift file:

import PackageDescription

let package = Package(
    name: "YourPackageName",
    dependencies: [
        .Package(url: "https://github.com/coryalder/Slow.git", majorVersion: 0),
    ]
)