I'm struggling to figure out how to add a custom back button to a view, while following the NavigateAndLoad case study example.
when I add
@Environment(\.presentationMode) var mode
to the CounterView, the IfLetStore breaks in the parent view.
NavigationLink(
destination: IfLetStore(
self.store.scope(
state: \.selection?.value,
action: LoadThenNavigateListAction.counter
),
then: CounterView.init(store:mode:)
),
tag: row.id,
selection: viewStore.binding(
get: \.selection?.id,
send: LoadThenNavigateListAction.setNavigation(selection:)
)
)
The error is:
Cannot convert value of type '(Store<CounterState, CounterAction>, Environment<Binding>) -> CounterView' to expected argument type '(Store<CounterState, CounterAction>) -> CounterView'
Can anyone guide me on how to rewrite the IfLetStore statement, so that it can initialize the CounterView while it includes an environment variable?