Post

Replies

Boosts

Views

Activity

Reply to SwiftUI Gestures prevent scrolling with iOS 18
if you facing ScrollViews blocked ur tap/long press handle. u can try this code: struct TestView: View { var body: some View { ZStack { Button("") { // Your tap press handler print("tap press") } // Replace Rectangle with the view you need Rectangle() .foregroundStyle(Color.white.opacity(0.011)) .gesture( LongPressGesture(minimumDuration: 0.5) .onEnded { _ in // Your long press handler print("long press") } ) } .highPriorityGesture( TapGesture().sequenced(before: DragGesture()) ) } } the important code is add TapGesture().sequenced(before: DragGesture()) inside highPriorityGesture and handle the tap press inside Button action.
Oct ’24