jonhull / GradientSlider

MIT License
241 stars 29 forks source link

Can't drag thumb icon when displayed inside formsheet (iOS 13) #13

Open kfound opened 4 years ago

kfound commented 4 years ago

Formsheets in iOS13 introduced the ability to drag the sheet down to dismiss it. This causes a problem with the GradientSlider where you can't drag the slider very far - it stutters and you'll see a call to cancelTracking invoked for seemingly no reason. If the GradientSlider is displayed in a popover; it works fine.

To fix the issue, you need to add code into the GradientSlider to ignore a UIPanGestureRecognizer:

override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
        if gestureRecognizer is UIPanGestureRecognizer {
            return false
        }
        return true
}

You might also want to check isTracking == true but I found it didn't matter.

alexanderconstancio commented 4 years ago

Exactly what I needed thank you