Observable
on Swift.
Class: https://github.com/iqbalansyor/ObservableSwift/tree/master/ObservableSwift/Observable
- Creating a dummy flow to better understanding using of this class with view model
- Adding documentation how to using this class on
.md
(v)
let stringPassed: Observable<String> = Observable(value: "initial value")
viewModel.stringPassed.value = "String Passed"
viewModel.voidPassed.next()
viewModel.stringPassed.subscribe(observer: self) { [weak self] (text) in // Change value here }
_ = viewModel.voidPassed.subscribe(observer: self) { [weak self] (_) in // Do action here }
- Previous research
ObservableProtocol
on Objective-C: https://github.com/iqbalansyor/ObserverProtocol/tree/master/ObserverProtocolExample/TVL
- Generic type can't provide for primitive type (
BOOL
,float
,Void
and etc)