Post

Replies

Boosts

Views

Activity

.highPriorityGesture causes ScrollView to be unable to scroll
This problem will occur in Xcode 16 beta and iOS 18 beta, are there any changes to the function of highPriorityGesture in iOS 18? Example code is: import SwiftUI struct ContentView: View { @State private var dragable: Bool = false @State private var dragGestureOffset: CGFloat = 0 var body: some View { ZStack { ScrollViewReader { scrollViewProxy in ScrollView(showsIndicators: false) { cardList .padding(.horizontal, 25) } } } .highPriorityGesture(dragOffset) } var cardList: some View { LazyVStack(spacing: 16) { Text("\(dragGestureOffset)") .frame(maxWidth: .infinity) .padding(.vertical,8) .background { RoundedRectangle(cornerRadius: 8) .fill(.gray) } //Display 100 numerical values in a loop ForEach(0..<100) { index in Text("\(index)") .frame(maxWidth: .infinity) .padding(.vertical,8) .background { RoundedRectangle(cornerRadius: 8) .fill(.gray) } } } } var dragOffset: some Gesture { DragGesture() .onChanged { value in if abs(value.translation.width) > 25 { dragable = true dragGestureOffset = value.translation.width } } .onEnded { value in if abs(value.translation.width) > 25 { dragable = false dragGestureOffset = 0 } } } }
2
3
516
Jul ’24