RAReorderableLayout
RAReorderableLayout copied to clipboard
Set any value in 'minimumPressDuration' of UILongPressGestureRecognizer
Hello ,
I want to set any value in 'minimumPressDuration' of UILongPressGestureRecognizer. But, I do not have a better idea.
Can you add this feature?
// gesture recognizers
fileprivate func setUpGestureRecognizers() {
guard let collectionView = collectionView else { return }
guard longPress == nil && panGesture == nil else {return }
longPress = UILongPressGestureRecognizer(target: self, action: #selector(RAReorderableLayout.handleLongPress(_:)))
self.longPress?.minimumPressDuration = 0.001
panGesture = UIPanGestureRecognizer(target: self, action: #selector(RAReorderableLayout.handlePanGesture(_:)))
longPress?.delegate = self
panGesture?.delegate = self
panGesture?.maximumNumberOfTouches = 1
let gestures: NSArray! = collectionView.gestureRecognizers as NSArray!
gestures.enumerateObjects(options: []) { gestureRecognizer, index, finish in
if gestureRecognizer is UILongPressGestureRecognizer {
(gestureRecognizer as AnyObject).require(toFail: self.longPress!)
}
collectionView.addGestureRecognizer(self.longPress!)
collectionView.addGestureRecognizer(self.panGesture!)
}
}
open func cancelDrag() {
cancelDrag(nil)
}
Yeah, this really should be configurable.