SwiftUI - scrollTo Animation Disappears

In the following code snippet, I use proxy.scrollTo() to scroll to a target. In order to animate the scrolling process, I wrapped this function call inside withAnimation. This code works on iOS 16, but on iOS 17, it scroll without any animation. Is this a bug or is there an API change? Thanks!

import SwiftUI

struct ScrollTest: View {
    var body: some View {
        ScrollViewReader { proxy in
            List {
                Button("Begin Scroll") {
                    withAnimation {
                        proxy.scrollTo(15, anchor: .top)
                    }
                }
                
                ForEach(1..<50) { i in
                    Text("Item \(i)")
                        .id(i)
                }
            }
        }
    }
}

Likely a bug can you file a feedback report?

I would add that the bug only occurs if the minimum deployment target is set below iOS 17, otherwise the animation works correctly. It's still not fixed in beta 6.

Not sure this helps, on iOS 17 there is an API called scrollPosition which is an alternate to ScrollViewReader

Refer: https://developer.apple.com/wwdc23/10159

This issue has been fixed in iOS 17 developer beta 7.

SwiftUI - scrollTo Animation Disappears
 
 
Q