[Question] - Navigation State #873
-
Is there a recommended strategy for dealing with navigation state in TCA? The problem I'm encountering is I want to be able to serialize a list of actions that are dispatched to the store with their timestamps and then later, playback those actions on the store and watch how the application responds, essentially Redux DevTools for TCA. The problem is that some rather consequential actions can happen outside of TCA that result in a major application state change. One of the classic examples is pushing a navigation view onto the stack. In SwiftUI, if I have a I'm not sure what the best way to handle this problem is because it seems like it would almost be a library feature, like a |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
Can you not achieve this with NavigationLinks 'isActive' binding, using a viewStore.binding where the setter sends an identifier for the active link to the store? |
Beta Was this translation helpful? Give feedback.
-
Going to close this, I think the original question of how to incorporate navigation state into an application has been answered. |
Beta Was this translation helpful? Give feedback.
-
I wanted to come back to this because I believe I found a spot where Let's say I'm building a 1Password esque app and I have a screen where I want the user to input their master password. When they hit the button, I dispatch some action that turns a boolean on in my state called The problem is, because hitting the button already set the state appropriately, I just need the navigation link to react to that boolean and not send a value. However there's no variant of Here's a code example: NavigationLink("", isActive: viewStore.binding(get: { $0.savedPassword }, send: { value in
if value {
return .finishAndProceed
} else {
return .unwind
}
)) {
MultifactorAuthenticationSetupFlow(store: store)
}
.hidden() What happens is that I end up at the least, adding an additional action thats not needed, in this case @stephencelis @dmeehan1968 does that make sense? I think it'd be very useful to have |
Beta Was this translation helpful? Give feedback.
Can you not achieve this with NavigationLinks 'isActive' binding, using a viewStore.binding where the setter sends an identifier for the active link to the store?