SwiftUI: Drag Gesture (swipe up) which doesn't work anymore after macOS update

Hello,

I'm working on a Swift/SwiftUI project, which is basically finished and everything was working well when I was doing it on macOS Monterey/Xcode 14.0.1, but since I upgraded to macOS Sonoma/Xcode 15.3, some issues have appeared from nowhere, without me doing any changes to the code in the meantime.

Among these issues, I made a Drag Gesture (swipe up) on a ZStack, to navigate from a view to another. As I just said, like the rest it was initially working but it doesn't work anymore since my last macOS update and I didn't change anything. Here is the code related to it:

.gesture(
    DragGesture()
         .onEnded { gesture in
             if gesture.translation.height < -50 {
                 showGalleryView = true
              }
    }
)

I tried to find the origin of the problem by doing prints, and I had the confirmation that the gesture is detected and the value of showGalleryView (which is a @State/@Binding variable) is indeed changed to true. But it doesn't have any effect, it stays on the initial view. Here are the results when I include the prints in the code above:

I don't understand if there is a problem elsewhere in my code or if the problem is caused by something like a parameter in Xcode or the macOS update. Any ideas?

Thanks.

Replies

Put a TapGesture() before the DragGesture(), and see if that helps. It sometimes works by passing the gesture down.