.gesture(LongPressGesture(minimumDuration: 0, maximumDistance: 10.0).onChanged(){})
Hi here is example for change duration of gesture according to your need:
Rectangle() .fill(isPressing ? Color.orange : .gray) .frame(width: 50, height: 30) .onLongPressGesture(minimumDuration: 0.25, maximumDistance: 50, pressing: { (isPressing) in if isPressing { // called on touch down } else { // called on touch up message = "TAP" } }, perform: { message = "LONG\nPRESS" })
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.