Skip to content

Commit be1ac7a

Browse files
committed
Amend dispatch to return a subscription reference
1 parent 91ea6d8 commit be1ac7a

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#Upcoming Release
22

3+
#4.0.1
4+
**API Changes:**
5+
6+
- `dispatch(_ stream:)` now returns a subscription reference.
7+
38
#3.0.6
49
**Breaking API Changes:**
510

Sources/CoreTypes/Store.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,12 @@ open class Store<ObservableProperty: ObservablePropertyType> {
3535
}
3636
}
3737

38-
public func dispatch<S: StreamType>(_ stream: S) where S.ValueType: Action {
39-
disposeBag += stream.subscribe { [unowned self] action in
38+
@discardableResult
39+
public func dispatch<S: StreamType>(_ stream: S) -> SubscriptionReferenceType? where S.ValueType: Action {
40+
let disposable = stream.subscribe { [unowned self] action in
4041
self.dispatch(action)
4142
}
43+
disposeBag += disposable
44+
return disposable
4245
}
4346
}

0 commit comments

Comments
 (0)