Latest 1.0.0
Homepage https://github.com/gaetanzanella/AsynchronousOperation
License MIT
Platforms ios 10.0
Authors

Version
License
Platform

Requirements

Installation

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

pod 'AsynchronousOperation'

Usage

AsynchronousOperation is a lightweight version of the sample code presented at the WWDC Advanced NSOperation session.

Its main purpose is to make it easier to create Operation wrapping asynchronous tasks such as a HTTP request.

Subclass AsynchronousOperation or directly instanciate a AsynchronousBlockOperation.

let operationQueue = OperationQueue()

let operation = AsynchronousBlockOperation(task: { completion in
    httpManager.fetch(User.self, using: request) { result in
        // ... Handle result
        completion()
    }
})

operationQueue.addOperation(operation)

// OR

class FetchUserOperation: AsynchronousOperation {

    override func execute() {
        httpManager.fetch(User.self, using: request) { [weak self] result in
            // ... Handle result
            self?.finish()
        }
    }
}

I mainly use it to chain multiple promises that are not initialized at the same time.

Author

gaetanzanella, [email protected]

License

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

Latest podspec

{
    "name": "AsynchronousOperation",
    "version": "1.0.0",
    "summary": "Operation subclasses to perfom asynchronously",
    "swift_version": "4.2",
    "description": "AsynchronousOperation is a lightweight version of the sample code presented at the WWDC session https://developer.apple.com/videos/play/wwdc2015/226/.",
    "homepage": "https://github.com/gaetanzanella/AsynchronousOperation",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "gaetanzanella": "[email protected]"
    },
    "source": {
        "git": "https://github.com/gaetanzanella/AsynchronousOperation.git",
        "tag": "1.0.0"
    },
    "platforms": {
        "ios": "10.0"
    },
    "source_files": "AsynchronousOperation/Classes/**/*"
}

Pin It on Pinterest

Share This