Skip to content

A companion library to BrightFutures with extensions to CocoaTouch that provide a Future based interface to asynchronous API's

License

Notifications You must be signed in to change notification settings

Thomvis/FutureProofing

Repository files navigation

FutureProofing

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.

Join the chat at https://gitter.im/Thomvis/BrightFutures Carthage compatible CocoaPods version

Extensions sample

UIKit

UIView

UIView.animate(withDuration: 0.5) {
  // perform animation
}.onComplete { _ in
  // callback executed when the Future returned from animateWithDuration completes
}

Foundation

URLSession

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
}

AppKit

NSWindow

let f = window.beginSheet(sheetWindow: sheetWindow)
f.onSuccess { modalResponse in
  // do something with the response
}

Installation

  1. Add the following to your Podfile:

    pod 'FutureProofing'
  2. Integrate your dependencies using frameworks: add use_frameworks! to your Podfile.

  3. Run pod install.

  1. Add the following to your Cartfile:

    github "Thomvis/FutureProofing"
    
  2. Run carthage update and follow the steps as described in Carthage's README.

About

A companion library to BrightFutures with extensions to CocoaTouch that provide a Future based interface to asynchronous API's

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •