-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge on a collection of observables #579
Comments
How's this? Observable<Void>.of(btn1.rx_tap, btn2.rx_tap).merge() |
Its not as much the syntax but the reason why an observable of observables must be created before they can be merged. Why couldn't it be merged exactly at the time of the call instead of as they are emitted? |
Hi @joeljeske , Observable<Void>.of(btn1.rx_tap, btn2.rx_tap).merge() ... this does give a little more verbosity, but also clarity to the code. [ob1, ob2].merge() ... is little less clear that it's related with Rx, but not too bad. I'm thinking of maybe creating additional convenience for this since we do have the same for |
Is there any reason why we can't have |
@LukaJCB I think |
@Dwar3xwar correct me if I'm wrong, but doesn't withLatestFrom have completely different semantics? Merge emits if any of the given Observables emit, while withLatestFrom only emits when the first one does. |
We'll change this in RxSwift 3.0. Observable.merge([ob1, ob2])
Observable.concat([ob1, ob2]) and another overloads ob1.merge(ob2)
ob1.concat(ob2) This should please everyone I believe. |
@kzaher Those overload were added ? |
@kzaher I think actually is |
It doesn't look like ob1.merge(ob2) got implemented? |
Neither does |
This combined with the Had the first use case where this would've been quite neat today :) |
Hi guys, I've just pushed additional The only operator that isn't implemented now is For Observable.merge(btn1.rx_tap, btn2.rx_tap)
Observable.merge([btn1.rx_tap, btn2.rx_tap]) The reason why we currently don't plan to support After some discussions with other core contributors, we've decided
I'm going to close this issue for now, but feel free to reopen it if there is something wrong. |
Hi @kzaher , I'm running a playground on RxSwift 3.3.1 and maybe I didn't fully understand this new
The first Thank you in advance and sorry if I'm doing any silliness here! |
From the merge docs here, it would make sense that I could merge a collection of similarly typed observables like the following
Instead, it appears that it only accepts an observable stream of similarly typed observables.
The
toObservable()
call seems like unnecessary overhead as the set of observables won't change and is completely known upfront.Am I missing something or is this how
merge()
is designed and used throughout all of Rx?The text was updated successfully, but these errors were encountered: