ios – How to disable the auto scroll to the top of the screen when coming back to the list from another view


Hi I have a question about swiftUI. As shown in the images below, I have a list of words that lead to another view. The problem is that when you tap the back button on the WordDetailView and go back to the List view you are at the TOP of the list. I want the users to be at the same position as they first tapped the word. How can I achieve this? Thank you in advance.
List View
WordDetailView

NavigationStack {
List {
     ForEach(uniqueWords.sorted(), id: \.self) { unique in
         NavigationLink(destination: WordDetailView(listing: unique)) {
             HStack {
                ListingItemView(listing: unique)
                                }
                            }
                        }
                    }
                    .onAppear {
                        getUniqueWords() // get the words to show
                    }
}
             

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img