I created a horizontally scrolling view modifier that essentially wraps the contents and applies a horizontal offset
based on a DragGesture
GestureState
.
It looks a little bit like this
@GestureState private var dragOffset: CGFloat = 0
content
.offset(x: dragOffset, y: 0)
.simultaneousGesture(DragGesture(minimumDistance: 20, coordinateSpace: .global)
.updating($dragOffset) { (value, gestureState, transaction) in
gestureState = value.translation.width
})
The problem I am seeing is that on the Pro Motion Display of the iPhone 13 Pro, the "offset" view does not smoothly slide along with your finger as it drags. Instead is is very jaggy or laggy, probably rendered with maybe 15 fps or so. On the iPhone 11 Pro I used before, the drag is very smooth and on the iOS 15 simulator it is smooth as well.
What is wrong here? Thanks for help!