5

I've had many similar issues to this when using ScrollViewand LazyVStack/ LazyHStack where the content of the lazy stack will stutter upon bouncing on the edge of the ScrollView.

First I thought it might be due to using complex Views on the lazy stack that would cause layout issues in SwiftUI but I've manage to come up with a MWE that uses a very simple view hierarchy and the issue is still there.

This causes a stutter when scrolling fast to the left and upon bouncing on the leading edge of the ScrollView:

ScrollView(.horizontal) {
    LazyHStack {
        Color.red.frame(width: 450)
        Color.green.frame(width: 250)
        Color.blue.frame(width: 250)
    }
}
.frame(width: 350)

Decreasing the width of the first view makes the stutter go away

ScrollView(.horizontal) {
    LazyHStack {
        Color.red.frame(width: 400) //<- No stutter
        Color.green.frame(width: 250)
        Color.blue.frame(width: 250)
    }
}
.frame(width: 350)

For this MWE the stutter only seems to happen on the device (maybe because I can't scroll fast enough in the simulator). However, I've had the same problem happen in the simulator with more complex views.

Any ideas if this is a bug in SwiftUI?

Tested on an iPhones Xs Max with Xcode 13 beta 1 and iOS 15.

  • Same here. Please ask in bug report. – Hwangho Kim Jun 21 '21 at 02:17
  • 1
    @HwanghoKim I did that already and even submitted a Technical Support Incident for a workaround, but the feedback I got said the issue would be best handled by the engineering team directly as it probably requires changes to the framework. Apparently this is a bug in SwiftUI. Interestingly, I've only experienced it when bouncing at the beginning of a `ScrollView`(i.e. top and leading edges for vertical and horizontal scroll axis, respectively). – seriouslysupersonic Jun 22 '21 at 08:52
  • I'm suffering from this as well — as far I can tell it's a bug in SwiftUI, or it's "expected" as the documentation states that LazyVStacks are prone to layout issues . I submitted a TSI and I haven't heard back yet. Here's my post: https://stackoverflow.com/questions/68459594/content-with-variable-height-in-a-lazyvstack-inside-a-scrollview-causes-stutteri Really hope we can resolve this... – chrysb Jul 25 '21 at 16:44
  • I already submitted a TSI. The feedback they gave was that this is a framework issue and it needs to be addressed by the engineering team directly. They couldn't offer any workaround with SwiftUI. I guess, this sort of layout must still be implemented in UIKit, that is... if we need to reuse views... My TSI still says that no one else submitted similar reports. I don't know which is a bit weird... – seriouslysupersonic Jul 26 '21 at 17:46

0 Answers0