Swift Package Index


Useful classes to handle asynchronous code


  • The latest stable release is 2.3.0. Released 8 months ago.
  • The last commit to master was 8 months ago.

Swift Version Compatibility

  • 2.3.0 and master
    5.3
    5.2
    5.1
    5.0
    4.2
Full build results

Platform Compatibility

  • 2.3.0 and master
    iOS
    macOS(Intel)
    macOS(ARM)
    Linux
    tvOS
    watchOS
Full build results

AsyncRequest

Cocoapods Platform License codebeat badge

Useful classes to handle asynchronous code

A Request is an object containing closures that can be called asynchronously at some point in the future:

let request = Request<String>(successHandler: { string in
    print(string)
})

Depending on the result of some computation the request can be successful:

request.complete(with: "Success!")

Or not:

request.complete(with: TestError.error)

In any case the request finishes:

request.finished {
    print("did finish")
}

Requests can be canceled:

request.cancel()

Closures can be added:

request.success(handler: { string in
    print("Result: \(string)")
})

request.fail { error in
    print("Error: \(error)")
}

request.finished {
    print("request did complete")
})