Toggles states aren't saved #2940
Replies: 1 comment 1 reply
-
This is entirely expected. When you push NavigationLink(
"Go to settings",
state: ContentFeature.Path.State.settings(store.settings)
) that value, Now, this is a very timely issue for you to have. There is currently a TCA beta for an upcoming feature called shared state (#2857) that is a very ergonomic way to pass state around with reference-y semantics like you want to. I would highly recommend you watch the (still-in-progress) video series about this feature, and in particular, in the solution-part-2 episode, they demonstrate passing shared state around different levels of a navigation stack, exactly what it looks like you are trying to accomplish. |
Beta Was this translation helpful? Give feedback.
-
I was able to reproduce an issue we had in one of our projects where we have toggles in a
SettingsView
and if we change the value of one of these toggles they won't be saved as a state in memory. The state of Settings keeps resetting even when I am trying to use the same state over and over again.Here is a video that shows the issue:
https://github.com/pointfreeco/swift-composable-architecture/assets/19314956/524196e5-0794-4206-bf43-95b7833d9c9f
The code:
I want to preserve the settings state after the second navigation, how can I do that?
Beta Was this translation helpful? Give feedback.
All reactions