Latest 1.0.3
Homepage https://github.com/Gerrel/DispatchThrottle
License MIT
Platforms ios 9.0, osx 10.10, tvos 9.0, watchos 2.0
Frameworks Foundation
Authors

CI Status
Version
License
Platform

Throttle mechanism for DispatchQueue. Only the last dispatched code-block will be executed when delay has passed.

Installation

DispatchThrottle is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'DispatchThrottle'

For documentation

Run the following terminal command in the root of the project

$ jazzy

Example

  1. Define DispatchThrottle as a variable:
let throttle = DispatchThrottle(time: DispatchTimeInterval.milliseconds(100))
  1. Use throttle in func that should have delayed execution if multiple (unnecessary) invocation can be received in a short time
let throttle = DispatchThrottle(time: DispatchTimeInterval.milliseconds(100))

// ...

internal func save() {

    DispatchQueue.global(qos: .background).async(throttle: throttle) {
        // Write file to disk
    }
}

License

DispatchThrottle is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "DispatchThrottle",
    "version": "1.0.3",
    "summary": "Throttle mechanism for DispatchQueue. Only the last dispatched code-block will be executed when delay has passed.",
    "description": "In some area's on your app it is unnecessary to process events immediately.nFor example a user's typing in a search field or when multiple events with the same action are triggered rapidly, but only need processing once when finished.",
    "homepage": "https://github.com/Gerrel/DispatchThrottle",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Gerrel Krishan": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Gerrel/DispatchThrottle.git",
        "tag": "1.0.3"
    },
    "platforms": {
        "ios": "9.0",
        "osx": "10.10",
        "tvos": "9.0",
        "watchos": "2.0"
    },
    "source_files": "DispatchThrottle/Classes/**/*",
    "frameworks": "Foundation",
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This