Latest 0.1.4
Homepage https://github.com/kocodude/Operator
License MIT
Platforms ios 9.0
Authors

Operator – Succinct Concurrent Code in Swift

Build Status
CocoaPods
Platform

Operator is a wrapper for Grand Central Dispatch written in Swift.

Requirements

  • iOS 9.0+
  • Xcode 7.3+

Communication

  • If you need help, DM @kocodude
  • If you’d like to ask a general question, for now open an issue.
  • If you found a bug, open an issue.
  • If you have a feature request, open an issue.
  • If you want to contribute, submit a pull request.

Installation

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

pod "Operator"

Usage

Operator’s default context model uses the main queue when invoked on the main thread and the global queue when invoked anywhere else. Operator supports contexts in line with the available global queues:

  • Main
  • High Priority
  • Default Priority
  • Low Priority
  • Background

Operator supports the creation of serial and concurrent queues by passing a name with the enums:

  • Concurrent("concurrent.queue.name")
  • Serial("serial.queue.name")

async

Operator.async {
    print("Execute asynchronously")
}

which is the same as:

Operator.async(.DefaultContextModel) {
    print("Execute asynchronously")
}

To use a different context:

Operator.async(.Background) {
    print("Execute in the background")
}

delay

Operator.delay(forSeconds: 10.0) {
    print("Execute this 10 seconds later")
}
let customConcurrentContext = Context.Concurrent("com.myapp.mynewconcurrentqueue")
Operator.delay(forSeconds: 10.0, customConcurrentContext) {
    print("Execute this 10 seconds later")
}

sync

Operator.sync {
    print("Execute this 10 seconds later")
}
Operator.sync(.High) {
    print("Execute this 10 seconds later")
}

tick

Operator.tick {
    print("Execute this 10 seconds later")
}

Author

Grant Oladipo

e: [email protected]

t: @kocodude

License

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

Latest podspec

{
    "name": "Operator",
    "version": "0.1.4",
    "summary": "A wrapper for GCD written in Swift.",
    "description": "Operator simplifies the GCD api for use in Swift and focuses on being succinct.",
    "homepage": "https://github.com/kocodude/Operator",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Grant Oladipo": "[email protected]"
    },
    "source": {
        "git": "https://github.com/kocodude/Operator.git",
        "tag": "0.1.4"
    },
    "social_media_url": "https://twitter.com/kocodude",
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "Operator/Classes/**/*",
    "deprecated": true,
    "deprecated_in_favor_of": "AsyncSwift"
}

Pin It on Pinterest

Share This