Replies: 1 comment
-
It is not going to work to create EventDetailsView(
store: .init(
initialState: .init(event: event),
reducer: eventDetailsReducer,
environment: .init(eventClient: .live)
)
) That will effectively make the behavior of Typically if feature A needs to navigate to feature B, then feature A's domain needs to contain feature B. We have a lot of examples of this in the case studies, demo applications and in isowords. For example, in this case study the parent domain holds onto some optional So, in your situation you may want to hold onto optional And for ForEachStore(
store.scope(state: \.events, action: EventListAction.event)
) { eventStore in
EventView(store: eventStore)
} It is worth noting that the navigation APIs aren't fully baked in the library yet. It's possible to accomplish, and all of the case studies and demo applications show how, but it isn't very ergnomic right now. We have some new tools coming soon that will make the situation much better. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm currently running into an issue with bubbling up view-specific actions to the App/Root Reducer. The problem is that my SwiftUI view takes in a very specific type of store (
Store<EventListState, EventListAction>
in this example) and allows the view to navigate to different views that have their own types of stores (seeEventDetailsView
andEventView
lines).I couldn't use
ForEachStore
in this scenario because the different views require different store types. Since I am initializing new stores for each view, and they both require anEvent
object for the state, I use a regularForEach
and initialize new stores for each view. This cuts off their connection with the App/Root Reducer.What is the proper way to handle a scenario where your item rows require their own state and action, but can also navigate to another view which has its own state and action types?
Beta Was this translation helpful? Give feedback.
All reactions