Reactivecocoa: Ambiguous use of 'flatten', new in 4.2.x

Created on 4 Jun 2016  ·  10Comments  ·  Source: ReactiveCocoa/ReactiveCocoa

Perhaps related to https://github.com/ReactiveCocoa/ReactiveCocoa/issues/2530

This worked before updating to 4.2.x.

I'm new to ReactiveCocoa and have no idea how to resolve this.

var signalProducers: [SignalProducer<Void, NSError>] = [ some0SignalProducer ]
signalProducers += some1SignalProducers
signalProducers += some2SignalProducers
signalProducers += some3lSignalProducers

return SignalProducer(values: signalProducers)
            .flatten(FlattenStrategy.Concat)
question

All 10 comments

You'll need to declare the type of the signal producer. We added overloads that handle NoError, but that can confuse the type inferencer in some cases.

This should work:

var signalProducers: [SignalProducer<Void, NSError>] = [ some0SignalProducer ]
signalProducers += some1SignalProducers
signalProducers += some2SignalProducers
signalProducers += some3lSignalProducers

return SignalProducer<SignalProducer<Void, NSError>, NoError>(values: signalProducers)
            .flatten(FlattenStrategy.Concat)

Sorry for the disruption!

@mdiep saved me! 🙇

@mdiep is it something that planned to be addressed in future? We got a lot of explicit types now because of this. It is not so fast to write it now, as well as it is not concise and harder to read.

@nikita-leonov IIUC this should be already addressed by https://github.com/ReactiveCocoa/ReactiveCocoa/pull/3043 and released as v4.2.2.

@ikesyo thanks! I noticed 4.2.2 is not released in CocoaPods yet. Is it something that core contributors can handle? I see you listed in owners for a pod.

Which it still needs a test, as mentioned in #3043 😁

@NachoSoto Yeap it is missing unit tests, but already merged into 4.2.2 and already released :( It seems logical to have 4.2.2 released in CocoaPods too.

@NachoSoto The test was added in #3048. :wink:

@ikesyo oh derp of course. Thanks!

@ikesyo ok I handled it. @ashfurrow shared access to podspec trunk and I released 4.2.2.

Was this page helpful?
0 / 5 - 0 ratings