Package updated
A Request is an object containing closures that can be called asynchronously at some point in the future:
Request
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") })
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
AsyncRequest
Useful classes to handle asynchronous code
A
Request
is an object containing closures that can be called asynchronously at some point in the future:Depending on the result of some computation the request can be successful:
Or not:
In any case the request finishes:
Requests can be canceled:
Closures can be added: