I am currently using UIDragInteraction
and UIDropInteraction
made available in iOS 11 to make a simple drag and drop feature, where user could drag
There's no obvious way to do this, but I was just facing the same problem and took a peek into the gesture recognizers of the view that the dragInteraction is attached to. It a _UIDragLiftGestureRecognizer
which is not part of the public API, but turns out this is just a subclass of UILongPressGestureRecognizer
.
So, after having added your UIDragInteraction
to your view, and after having added that view to the view hierachy (since I'm using a custom UIView subclass I just added it into didMoveToSuperview()
), you can do something like this:
if let longPressRecognizer = gestureRecognizers?.compactMap({ $0 as? UILongPressGestureRecognizer}).first {
longPressRecognizer.minimumPressDuration = 0.1 // your custom value
}