Search code examples
iosreactive-swift

How to trigger block from any of > 2 signal producers?


I see in How to trigger block from any of multiple signal producers? that 2 signal producers can be combined using combineLatest.

But what if there's 3 or more signal producers, where you want access to all 3 values?

I tried:

 let prop = property1.combineLatest(with: property2).combineLatest(with: property3)

 prop.producer.startWithValues { ((val1, val2), val3) in
     // do stuff here
 }

But I get "Closure truple parameter does not support destructuring". Any other way to do this?


Solution

  • You can use like this:

     let prop = SignalProducer.combineLatest(property1, property2, property3)