Skip to content

Commit

Permalink
Replace dispatch with typealias
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimillian committed Jul 23, 2019
1 parent ccbafdd commit 62e52f2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Sources/SwiftUIFlux/connector/ConnectedView.swift
Expand Up @@ -12,12 +12,12 @@ public protocol ConnectedView: View {
associatedtype Props
associatedtype V: View

func map(state: State, dispatch: @escaping (Action) -> Void) -> Props
func map(state: State, dispatch: @escaping DispatchFunction) -> Props
func body(props: Props) -> V
}

public extension ConnectedView {
func render(state: State, dispatch: @escaping (Action) -> Void) -> V {
func render(state: State, dispatch: @escaping DispatchFunction) -> V {
let props = map(state: state, dispatch: dispatch)
return body(props: props)
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/SwiftUIFluxTests/SwiftUIFluxTests.swift
Expand Up @@ -30,7 +30,7 @@ struct HomeView: ConnectedView {
return "\(props.count)"
}

func map(state: TestState, dispatch: @escaping (Action) -> Void) -> Props {
func map(state: TestState, dispatch: @escaping DispatchFunction) -> Props {
return Props(count: state.count,
onIncrementCount: { dispatch(IncrementAction()) })
}
Expand Down

0 comments on commit 62e52f2

Please sign in to comment.