|
According to this post by Paul https://www.hackingwithswift.com/articles/210/how-to-fix-slow-list-updates-in-swiftui I have issue when I navigate back to list from detail screen I'm back on top of the list, not on the position where I was navigating to detail screen. And I need to use above tip because sorting my list with 500+ rows was very slow. for example I tapped 20th row and when back it should show this row on screen, but I see first 5-6 (because of row height) Can you recommend any solution for this? |
|
Unfortunately i cant see any way around it at this time. It would be something to think about. The problem is that the body property of the view your list is in is being invoked when you come back from your detail view so its pretty much refreshing back to the originla state of the list. It would be intereating if there was a way to stop this. Thinking outside the box, if there was a way to capture the state of the view and then load that state instead of the original state of the view might work but im not sure how to go about this. I know closures capture the variables they reference so using this might be able to do it. Something to think about anyways Dave |
|
After reviewing my messy code, I edited the answer again to use a I think, setting the list I've tested with the code below an approach, where I set a state variable In belows example code, I have a main view with a list of 601 items (=Strings), shown in a I don't think this is a beautiful solution, there are certainly guys here who are able to make it better, but I think it is a good compromise to make Please give it a try.
|
|
Just had to fix one line
Makes it 001, 022 for easier sorting. |
|
SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.