i have in rxswift:
func foo() -> observable<int> { let subject = rxswift.replaysubject<int>.create(buffersize: 1) return subject.asobservable() }
how implement same concept in reactivekit?
with reactivekit 3 in beta (rk3 branch) can do:
func foo() -> signal<int, noerror> { let subject = replaysubject<int, noerror>(buffersize: 1) return subject.tosignal() }
in reactivekit 2 replaysubject generalised on events:
func foo() -> stream<int> { let subject = replaysubject<streamevent<int>>(buffersize: 1) return stream(rawstream: subject.torawstream()) }
or
func foo() -> operation<int, error> { let subject = replaysubject<operationevent<int>>(buffersize: 1) return operation(rawstream: subject.torawstream()) }
Comments
Post a Comment