Latest 0.2.0
Homepage https://github.com/aiwo/GBAsyncOperation
License MIT
Platforms ios 9.0
Authors

CI Status
Version
License
Platform

Example

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

Requirements

None

Installation

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

pod 'GBAsyncOperation'

Usage

Import

import GBAsyncOperation

Subclassing a GBAsyncOperation

This is an example of a typical asynchronous operation subclass. For the proper operation lifecycle it is required to call finish() method upon async code completion. This will signal the operation that it should be finished, otherwise it will be stuck in the queue.

class MyAsyncOperation: GBAsyncOperation {

    // your properties

    var completion: () -> Void

    init(completion: @escaping () -> Void) {
        self.completion = completion 
    }

    override func main() {
        // your async code here, which eventually calls completeOperation()
    }

    func completeOperation() {
        guard !isCancelled else {
            return
        }

        completion()
        finish()
    }
}

Bundling operations using a GBSerialGroupOperation

GBSerialGroupOperation class provides an ability of grouping asynchronous operations in a bundle and creating a dependency between them

Author

Gennady Berezovsky

License

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

Latest podspec

{
    "name": "GBAsyncOperation",
    "version": "0.2.0",
    "summary": "Allows to create Swift Operations with asynchronous work packages",
    "swift_version": "4.0",
    "description": "Framework is mainly focused on isolating the work package from the package point into a asynchronous operation subclass. By doing this calling point class is able to implement and manipulate a queue of operations.",
    "homepage": "https://github.com/aiwo/GBAsyncOperation",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Gennady Berezovsky": "[email protected]"
    },
    "source": {
        "git": "https://github.com/aiwo/GBAsyncOperation.git",
        "tag": "0.2.0"
    },
    "social_media_url": "https://twitter.com/aiwo",
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "GBAsyncOperation/Classes/**/*"
}

Pin It on Pinterest

Share This