Skip to content

Commit

Permalink
Merge pull request #22 from magma-media/master
Browse files Browse the repository at this point in the history
allow dispatching actions as an array, without removing ability to dispatch with list of actions as arguments
  • Loading branch information
Qata authored Jan 28, 2019
2 parents 20ea919 + 2beab4c commit 0de1a3f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Sources/CoreTypes/Store.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ open class Store<ObservableProperty: ObservablePropertyType> {
self.middleware = middleware
}

open func dispatch(_ actions: Action...) {
open func dispatch(_ actions: [Action]) {
actions.forEach { action in
let dispatchFunction: (Action...) -> Void = { [weak self] (actions: Action...) in
actions.forEach { self?.dispatch($0) }
Expand All @@ -36,6 +36,10 @@ open class Store<ObservableProperty: ObservablePropertyType> {
}
}

open func dispatch(_ actions: Action...) {
self.dispatch(actions)
}

@discardableResult
open func dispatch<S: StreamType>(_ stream: S) -> SubscriptionReferenceType where S.ValueType: Action {
let disposable = stream.subscribe { [unowned self] action in
Expand Down

0 comments on commit 0de1a3f

Please sign in to comment.