-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Description
Working with sequence of events instead of elements might be important in some cases. When we want to prevent sequence from completion. Or with RxSwiftExt .elements() and .errros() operators, which is useful in error handling idiom:
let events = source.flatMap { [service] in
service.get().asObservable().materialize()
}
.share()
events.elements().bind(to: ...)
events.error().bind(to: ...)Using single.asObervable().materialize() looks strange for me. It can be cutted to simple single.materialize(). Also we lose trait guarantees, because of cast to Observable.
I can't see any reasons why we can't materialize Single or Maybe.
My suggestion is to add .materialize() to Completable, Maybe and Single. Return type would be Single<Event<Element>>. And .dematerialize() for Single return type would be Maybe<T>
Here is the same issue & PR for RxJava - ReactiveX/RxJava#6278
What do you think @kzaher? Please, share your thoughts. I am ready to contribute :)
Here is a possible implementation - #1970