I am messing with the brand new ScrollView API for iOS 17 and have run right into a small surprising habits with the viewAligned
scrollTargetBehavior
.
@State non-public var colours: [Color] = Array(repeating: [.red, .orange, .yellow, .blue], rely: 100)
ScrollView(.horizontal) {
LazyHStack(spacing: 8) {
ForEach(colours, id: .self) { colours in
colour
.containerRelativeFrame(.horizontal) { size, _ in
size - 32
}
}
}
.scrollTargetLayout()
.padding(.horizontal, spacing)
.padding(.trailing, 16)
}
.scrollTargetBehavior(.viewAligned)
You will discover that once I begin sooner, after a second the views begin scrolling quickly, scrolling previous far more views than instances I swiped. I used to be questioning if there was a method to disable this, in order that the scroll view solely swipes if I swipe, and would not mechanically skip previous sure views like within the gif.