SwiftUI’s LongPressGesture is broken

Problem

LongPressGesture ignores minimumDuration parameter and succeeds immediately, also onEnded is never invoked.

Steps to reproduce

  1. Take Apple’s own sample code from their documentation: LongPressGesture.
  2. Remove transaction.animation = Animation.easeIn(duration: 2.0) line to make the effect more obvious.

Expected result:

  • The circle must turn red after 3 seconds of pressing on it, and turn green when released.

Actual result

  • The circle turns red immediately and never turns green.

Notes

I tried many combinations of .gesture and .simultaneousGesture applied to different types of views. Was anyone able to make the minimum duration work when passed to .gesture modifier?

OS: Ventura 13.1Xcode: 14.2Chip: Apple M1 Pro

Did you file a bug report? Without having checked this, it sounds like a bug to me.

I have the exact same symptoms and issues. FB13700251

SwiftUI’s LongPressGesture is broken
 
 
Q