Issue #805
Use LongPressGesture
to detect when long-press gesture has been recognized, and chain with DragGesture
to check when pressing still occurs
Image(systemName: SFSymbol.deleteLeft.rawValue)
.imageScale(.medium)
.onTapGesture {
onKeyCommand(.backspace)
}
.gesture(
LongPressGesture()
.onEnded { _ in
self.timer = Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true) { _ in
self.onKeyCommand(.backspace)
}
}
.sequenced(
before: DragGesture(minimumDistance: 0)
.onEnded { _ in
self.timer?.invalidate()
self.timer = nil
}
)
)