diff --git a/RaspSwift/RaspAggregator.swift b/RaspSwift/RaspAggregator.swift index 53d7a8f..3fb11fe 100644 --- a/RaspSwift/RaspAggregator.swift +++ b/RaspSwift/RaspAggregator.swift @@ -24,16 +24,11 @@ public class RaspAggregator { private let eventSwitch: BehaviorSubject> private let eventSink: PublishSubject = PublishSubject() -// private let stateSink: BehaviorSubject -// private let disposeBag = DisposeBag() public init(initial state: S, reducer: RaspReducer = RaspAggregator.defaultReducer, sources: Observable...) { self.eventSwitch = BehaviorSubject(value: Observable.merge(sources)) self.events = Observable.merge(self.eventSwitch.switchLatest(), self.eventSink) -// self.stateSink = BehaviorSubject(value: state) -// self.state = self.stateSink.asObservable() -// self.events.scan(state, accumulator: reducer.reduce).subscribe(self.stateSink).disposed(by: self.disposeBag) - self.state = self.events.scan(state, accumulator: reducer.reduce) + self.state = self.events.scan(state, accumulator: reducer.reduce).share() } public func select(selector: RaspSelector) -> Observable {