Created
February 22, 2016 04:17
-
-
Save NachoSoto/fd1949b6dc537353bf67 to your computer and use it in GitHub Desktop.
Converting [SignalProducer<U>] -> SignalProducer<[U]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://twitter.com/davedelong/status/701621040015810560: @NachoSoto is there a way to take a # of SignalProducer<U,E> and turn them in to SignalProducer<[U], E>? Like combineLatest but w/o tuples | |
let signals: [SignalProducer<T, E>] | |
let result: SignalProducer<[T], E> = | |
SignalProducer(values: signals) // create a producer that emits all signals. | |
.flatten(.Merge) // merge all values that they emit. | |
.collect() // collect all values into an array. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment