Short description of the issue:
I would like to implement something like a neverComplete operator that absorbs any complete notifications in the stream, I'd also like to do things like absorb errors completely (catch forces you to re-emit a brand new observable) i.e. do something like filter on the stream metadata.
This would all be possible with the materialise/dematerialise operators in the ReactiveX standard (since you could e.g. use the standard stream filter operator) - I don't know of any other ways to achieve this since almost all operators do not give access to the stream metadata.
In the implementation there should also be ways to generate stream metadata so for example you can map an event that fulfils a condition to e.g. an onCompleted to close the stream.
Hi @brendanarnold ,
I think we should focus more on high level sequence concept.
neverComplete => .concat(Observable.never())
absorb errors completely => catchError { _ in Observable.empty() }
In the implementation there should also be ways to generate stream metadata so for example you can map an event that fulfils a condition to e.g. an onCompleted to close the stream.
xs.takeWhile { x in ... }
Is there a good construct or way to create custom sequences , like Driver, where this information is passed down to the caller?
Hi @gravicle ,
can you maybe elaborate your question?
For example, I want an Observable that is also neverComplete and name it something where these traits are obvious. So, to consumers of the API, it is obvious that this is a neverEnding sequence. Like so:
func editingEvents() -> NeverEndingObservable<EditingEvent> { ... }
As @brendanarnold posited, sequences like neverEnding or single are great semantic clues and I am looking for a way to build them. However, Observable is not open, so NeverEndingObservable cannot inherit from it. Is there another way of building such semantic constructs and inherit behaviors of Observables?
FWIW materialize and dematerialize are available in RxSwiftExt
@gravicle The way how you can create your custom Units is by implementing ObservebleConvertableType
Hi guys,
what are you using materialize and dematerialize for?
I've gave some thought about these operators because there has been a lot of requests about adding them to this repo.
I think materialize/dematerialize could make sense in cases where one wants more control over sequence termination (should you include final element or not, etc.). They are also standard operators.
Let's add them to this repo then.
I've opened a PR that brings in materialize/dematerialize from RxSwiftExt here: https://github.com/ReactiveX/RxSwift/pull/1129
Most helpful comment
I've gave some thought about these operators because there has been a lot of requests about adding them to this repo.
I think
materialize/dematerializecould make sense in cases where one wants more control over sequence termination (should you include final element or not, etc.). They are also standard operators.Let's add them to this repo then.