Saturday, November 7, 2026
HomeiOS Developmentios - Easy methods to create a particular LongPressGesture in SwiftUI?

ios – Easy methods to create a particular LongPressGesture in SwiftUI?

[ad_1]

For an App I am engaged on I need to create a particular LongPressGesture.

It should not be triggered earlier than a customized time quantity (possibly 2 seconds, would not actually matter), but it surely additionally ought to solely be triggered, while you launched the Button (I do know it is not a Button however I prefer to name it this manner) after the customized time quantity.

So For Instance, I’ve a Button. Once I Press it for One Seconds, nothing ought to occur. It needs to be pressed for a minimal period of time (e.g. 2 Seconds) seconds, but in addition then, the occasion additionally solely ought to occur, when the consumer releases the Button.

I hope that is considerably comprehensible.

I’ve tried many issues like .onLongPressGesture() with .onChanged and .onEnded, however I could not determine a manner out to make this work.

I might admire any assist. Thanks.

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments