-
Notifications
You must be signed in to change notification settings - Fork 246
Open
Description
Hi, I like the redux way of linking the Android and IOS to the store data but find some limitations while working with multiple screens, one of them was how to use the ConnectedView
struct on the IOS side as a generic type and pass the correct State
based on the screen because now it's bound to the FeedState
, therefore, I need to create another ConnectedView
(or whatever) if I want to create another screen.
Something similar to the following:
public protocol ConnectedView: View {
....
func map(state: State, dispatch: @escaping DispatchFunction) -> Props
...
}
public extension ConnectedView {
func render(state: State, dispatch: @escaping DispatchFunction) -> V {
....
}
var body: StoreConnector<V> {
return StoreConnector(content: render)
}
}
public struct StoreConnector<V: View>: View {
@EnvironmentObject var store: ObservableObject
let content: (State, @escaping DispatchFunction) -> V
public var body: V {
return content(store.state, store.dispatch)
}
}
Metadata
Metadata
Assignees
Labels
No labels