Navigation with ForEachStore

Hello
I'm exploring TCA by creating a small weather app.
This app has an initial List with all user forecast locations (each of the "cells" performs a network request an updates itself to the current forecast). For this I'm using ForEachStore like so:

WithViewStore(self.store) { viewStore in
	List {
		ForEachStore(
		    self.store.scope(
		        state: { $0.locations }, action: AppAction.weatherForecast(index:action:)
		    ),
		    id: \.id,
		    content: ForecastPreviewView.init(store:)
		)
		.listRowInsets(EdgeInsets())
	}
}

How would I go about in the simplest of ways to show another screen with more information about the forecast when the user taps a specific cell? Usually I'd use NavigationLink, but I'm unable to do so because of ForEachStore.

1 Like
Terms of Service

Privacy Policy

Cookie Policy