diff --git a/CHANGELOG.md b/CHANGELOG.md index 84345b7..32ac7c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ #Upcoming Release +#4.0.1 +**API Changes:** + +- `dispatch(_ stream:)` now returns a subscription reference. + #3.0.6 **Breaking API Changes:** diff --git a/Sources/CoreTypes/Store.swift b/Sources/CoreTypes/Store.swift index cdb32a3..97619d4 100644 --- a/Sources/CoreTypes/Store.swift +++ b/Sources/CoreTypes/Store.swift @@ -35,9 +35,12 @@ open class Store { } } - public func dispatch(_ stream: S) where S.ValueType: Action { - disposeBag += stream.subscribe { [unowned self] action in + @discardableResult + public func dispatch(_ stream: S) -> SubscriptionReferenceType? where S.ValueType: Action { + let disposable = stream.subscribe { [unowned self] action in self.dispatch(action) } + disposeBag += disposable + return disposable } }