Post

Replies

Boosts

Views

Activity

Reply to Issue keeping scroll position in SwiftUI
Hey there! Still don't get any answer about this topic so I take the advantage of the WWDC to reopen it. I really would like to ensure I have not missed something. I did the full implementation using UIKit UICollectionView using performBatchUpdates to deal with my double sided pagination. But I still have some crashes issues or even strange animation when scrolling up to load above pages. So here are my 2 questions Is there a way to accomplish natively and properly a double-sided pagination in UIKit? Is this possible in SwiftUI? I'm attending WWDC this year so I would be happy to discuss irl about that topic. Best
Topic: UI Frameworks SubTopic: SwiftUI Tags:
1d
Reply to Issue keeping scroll position in SwiftUI
Hi @Vision Pro Engineer I have change my code to implement your solution, here is my new code ScrollViewReader { proxy in ScrollView { LazyVStack(alignment: .leading, spacing: 12) { ForEach(viewModel.rows) { row in Text(row.title) .frame(maxWidth: .infinity, minHeight: Constants.itemsHeight, alignment: .leading) .padding() .background(.thinMaterial, in: RoundedRectangle(cornerRadius: 12)) .padding(.horizontal) .id(row.id) // id used by .scrollPosition(id:) } } .scrollTargetLayout() .padding(.vertical) } .onChange(of: viewModel.rows, { oldValue, newValue in withAnimation { proxy.scrollTo(viewModel.scrollViewPosition) } }) } but still I have a glitch when opening the view, it does not keep the scroll position. Below you'll find a link to a video to better understand the behavior I would like to achieve. I did it using a UIKit UICollectionView. Link to the video: https://drive.google.com/file/d/1KKx7FyF3hPOaOfU02TxYctyJM2pnjlr6/view?usp=sharing As you can see on my video, we open the scrollview at a certain position and then load items above and below while keeping the scroll and without any glitch (except the performBatchUpdates classical animation) Hope this help Best
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’25
Reply to Issue keeping scroll position in SwiftUI
Hey there! Still don't get any answer about this topic so I take the advantage of the WWDC to reopen it. I really would like to ensure I have not missed something. I did the full implementation using UIKit UICollectionView using performBatchUpdates to deal with my double sided pagination. But I still have some crashes issues or even strange animation when scrolling up to load above pages. So here are my 2 questions Is there a way to accomplish natively and properly a double-sided pagination in UIKit? Is this possible in SwiftUI? I'm attending WWDC this year so I would be happy to discuss irl about that topic. Best
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
1d
Reply to Issue keeping scroll position in SwiftUI
Hey there! Any idea around this issue? Have a great day :) Loïc
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jan ’26
Reply to Issue keeping scroll position in SwiftUI
Hi @Vision Pro Engineer I have change my code to implement your solution, here is my new code ScrollViewReader { proxy in ScrollView { LazyVStack(alignment: .leading, spacing: 12) { ForEach(viewModel.rows) { row in Text(row.title) .frame(maxWidth: .infinity, minHeight: Constants.itemsHeight, alignment: .leading) .padding() .background(.thinMaterial, in: RoundedRectangle(cornerRadius: 12)) .padding(.horizontal) .id(row.id) // id used by .scrollPosition(id:) } } .scrollTargetLayout() .padding(.vertical) } .onChange(of: viewModel.rows, { oldValue, newValue in withAnimation { proxy.scrollTo(viewModel.scrollViewPosition) } }) } but still I have a glitch when opening the view, it does not keep the scroll position. Below you'll find a link to a video to better understand the behavior I would like to achieve. I did it using a UIKit UICollectionView. Link to the video: https://drive.google.com/file/d/1KKx7FyF3hPOaOfU02TxYctyJM2pnjlr6/view?usp=sharing As you can see on my video, we open the scrollview at a certain position and then load items above and below while keeping the scroll and without any glitch (except the performBatchUpdates classical animation) Hope this help Best
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’25