Latest 1.0.0.1
Homepage https://github.com/zafersevik/TaskRunner
License MIT
Platforms ios 9.3, requires ARC
Authors

CI Status
Version
Language
Platform
License

TaskRunner is a Swift utility module which provides functions to run closures easily in series and parallel.

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Examples

Creating closure list

let closure0: Task = {
    done in
    // run a sync/async method or a job
        if error != nil {
            done(error)
            return
        }
        done(nil)
}

let closure1: Task = {
    done in
    // run a sync/async method or a job
        if error != nil {
            done(error)
            return
        }
        done(nil)
}

let closure2: Task = {
    done in
    // run a sync/async method or a job
        if error != nil {
            done(error)
            return
        }
        done(nil)
}

let tasks = [closure0, closure1, closure2]

Running in series

TaskRunner.runInSeries(tasks: tasks, done: {
    error in
    if error != nil {
        // handle error
        return
    }
    // handle success
})

closure1 and closure2 start if and only if closure0 completes it’s job without an error.

Running in parallel

TaskRunner.runInParallel(tasks: tasks, done: {
    error in
    if error != nil {
        // handle error
        return
    }
    // handle success
})

closure0, closure1 and closure2 start running at the same time.

Installation

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

pod "TaskRunner"

Author

Zafer Sevik, [email protected]

License

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

Latest podspec

{
    "name": "TaskRunner",
    "version": "1.0.0.1",
    "summary": "A concurrent/series task runner for swift projects",
    "homepage": "https://github.com/zafersevik/TaskRunner",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Zafer Sevik": "[email protected]"
    },
    "source": {
        "git": "https://github.com/zafersevik/TaskRunner.git",
        "tag": "1.0.0.1"
    },
    "platforms": {
        "ios": "9.3"
    },
    "requires_arc": true,
    "source_files": "TaskRunner/Classes/**/*"
}

Pin It on Pinterest

Share This