Thomvis / BrightFutures

Write great asynchronous code in Swift using futures and promises
MIT License
1.9k stars 184 forks source link

Support for onComplete on sequence #136

Closed davideme closed 8 years ago

davideme commented 8 years ago

I would like on operator on SequenceType that return me form a [Future<>] a [Future<>] where all the future are completed.

Is this possible ?

Thomvis commented 8 years ago

I think sequence() is what you're looking for: https://github.com/Thomvis/BrightFutures/blob/master/BrightFutures/SequenceType+BrightFutures.swift#L77.

davideme commented 8 years ago

No, I'm using sequence in my project, but the problem is that if one of the futures fail, I can't get the data. My goal is to filter out the kind of error, that correspond to "NotFound" in my context, or to use the filter operator o a array of future.

Thomvis commented 8 years ago

You could first call recover on each future before putting it in the array and passing it to sequence.