I have a Screen A built in compose. I'm using it in side swiftui and at first it is working just fine. But when I navigate from Screen A to next screen and then come back to Screen A, it's lazy column is reset, like If I had scrolled to 10th item, when I come back to A, it will be scrolled to first item.
I am using swiftui's native NavigationStack for navigation.
Does anyone know how can I overcome this issue? It doesn't occur on android side though.
Khanzada Kashif
01/07/2024, 7:12 PM
Here are code snippets.
a
Arkadii Ivanov
01/07/2024, 9:37 PM
Assuming you are using the native SwiftUI navigation, I believe persistent state preservation is not supported by Compose for iOS yet. You can try using a Compose navigation library though.
k
Khanzada Kashif
01/08/2024, 5:46 AM
That would require me to change whole architecture of my app.
Khanzada Kashif
01/08/2024, 7:20 AM
I fixed it by moving my composable states to viewmodel, but it would be better if compose just does it out of the box.