A companion library to BrightFutures with extensions that provides a Future-based alternative to asynchronous API's.
The goal for this library is to become a community driven, best practice, helper-framework that most users of BrightFutures include when using the core library.
This project is inspired by, and based in part on, the PromiseKit extensions.
UIView.animate(withDuration: 0.5) {
// perform animation
}.onComplete { _ in
// callback executed when the Future returned from animateWithDuration completes
}
let (task, f): URLSession.FutureSessionDataTask = session.dataTask(with: URL(string: "http://www.example.org")!)
task.resume()
f.onSuccess { (data, response) in
// do something with the response
}.onFailure { error in
// handle error
}
let f = window.beginSheet(sheetWindow: sheetWindow)
f.onSuccess { modalResponse in
// do something with the response
}
-
Add the following to your Podfile:
pod 'FutureProofing'
-
Integrate your dependencies using frameworks: add
use_frameworks!
to your Podfile. -
Run
pod install
.