-
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
*Breaking changes* Change toArray() to return Single #1543
Comments
Hi @lucas34 , I think your complaint makes sense. It would be great if we could make this a non breaking change somehow. ToArraySingle looks a bit ugly to me, but maybe there is some obvious and elegant way we can encorporate these changes |
For non-breaking I don't think there's much you can do besides either:
|
Actually changing the return type has already been done for ignoreElements. I think it would be acceptable to change the return type for the next major release. Like 4.2.0. or 5.X. I'm scare that if we start to have |
The only problem I see here is that the most common use case is working with Observable, and not with Traits. (e.g. it's the "common grounds" of all RxSwift users) Using this sort of "Catchall" that would always return a Do we prefer people using Anyways If there is a consensus switching to |
Do you have any branch yet for the RxSwift 5.0 to target the PR ? |
Hey @lucas34 - We'd like to include this change in RxSwift 5, could you rebase on |
Fixed in #1923. |
Hi,
Current implementation of
toArray()
method inObservable
will return anotherObservable
. Since RxSwift now have all Traits. For me it will make more sense to returnSingle
Instead.let array: Single<[Int]> = Observable<Int>.just(1, 2, 3).toArray()
Observable<Int>.empty().toArray() // equivalent to Single<Int>.just([])
Unless there is any case that toArray will emit multiple items. But like the documentation says
Converts an Observable into another Observable that emits the whole sequence as a Single array and then terminates.
I'm migrating to Traits to make my streams more representative and more strict. If you agree to have more methods to return another type like some methods in
Observable
returns something else than Observable (Single, Maybe, Completable) I can suggest more operators.But if operator in
Observable
should only return anotherObservable
it's also understandable.The text was updated successfully, but these errors were encountered: