Skip to content

Commit

Permalink
State -> StoreState
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimillian committed Feb 6, 2020
1 parent 0b63e02 commit a48dd50
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions Sources/SwiftUIFlux/connector/ConnectedView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@
import SwiftUI

public protocol ConnectedView: View {
associatedtype State: FluxState
associatedtype StoreState: FluxState
associatedtype Props
associatedtype V: View

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

public extension ConnectedView {
func render(state: State, dispatch: @escaping DispatchFunction) -> V {
func render(state: StoreState, dispatch: @escaping DispatchFunction) -> V {
let props = map(state: state, dispatch: dispatch)
return body(props: props)
}

var body: StoreConnector<State, V> {
var body: StoreConnector<StoreState, V> {
return StoreConnector(content: render)
}
}
6 changes: 3 additions & 3 deletions Sources/SwiftUIFlux/connector/StoreConnector.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

import SwiftUI

public struct StoreConnector<State: FluxState, V: View>: View {
@EnvironmentObject var store: Store<State>
let content: (State, @escaping (Action) -> Void) -> V
public struct StoreConnector<StoreState: FluxState, V: View>: View {
@EnvironmentObject var store: Store<StoreState>
let content: (StoreState, @escaping (Action) -> Void) -> V

public var body: V {
content(store.state, store.dispatch(action:))
Expand Down

0 comments on commit a48dd50

Please sign in to comment.