Skip to content

Commit

Permalink
Remove convenience init and replace with default value for middleware (
Browse files Browse the repository at this point in the history
…#193)

Since the convenience init only set the Middleware for us, we can replace this with a default value of [] and have the Swift compiler auto-generate a convenience init for us.
  • Loading branch information
Qata authored and Malcolm Jarvis committed Jan 20, 2017
1 parent 52cc167 commit aefa97c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
6 changes: 1 addition & 5 deletions ReSwift/CoreTypes/Store.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,10 @@ open class Store<State: StateType>: StoreType {

private var isDispatching = false

public required convenience init(reducer: @escaping Reducer<State>, state: State?) {
self.init(reducer: reducer, state: state, middleware: [])
}

public required init(
reducer: @escaping Reducer<State>,
state: State?,
middleware: [Middleware]
middleware: [Middleware] = []
) {
self.reducer = reducer

Expand Down
3 changes: 0 additions & 3 deletions ReSwift/CoreTypes/StoreType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ public protocol StoreType {

associatedtype State: StateType

/// Initializes the store with a reducer and an intial state.
init(reducer: @escaping Reducer<State>, state: State?)

/// Initializes the store with a reducer, an initial state and a list of middleware.
/// Middleware is applied in the order in which it is passed into this constructor.
init(reducer: @escaping Reducer<State>, state: State?, middleware: [Middleware])
Expand Down

0 comments on commit aefa97c

Please sign in to comment.