josephlord/Async.legacy — pull request #6 by josephlord (2014-09-02 01:21:28+00:00)
Title: GCD chained arguments and returns take2

@chriseidhof

I've got strongly typed chained calls with arguments and return types working without any damage to the existing original API. (https://github.com/duemunk/Async/issues/8)

Surprisingly (or maybe not to you) the `someChainableAsyncObject.cancel()` still works passing the correct type `()` into the function.

```swift
func cancel(withValue:ReturnType) {
isCancelled = true
returnedValueOpt = withValue
}
```
By forcing the setting of the return on cancel it ensures that there is a non-Optional value to wait on (unless the block's type was optional to start with) and the chain can continue.

It needs more syntactic sugar on the new API features (Beta 6 doesn't seem to like the closure after the call syntax for these flexibly typed closures) and arguments are required on AsyncPlus calls even if it is (). It also needs more tests, a cleanup and I need to think about the effect on the drop in replacement nature of this for the main Async library but I'm happy I've got this far.