ImageSlideshow
ImageSlideshow copied to clipboard
Feature Request : Custom Double Tap Callback
Is it possible to add a double tap gesture to ImageSlideShow? I'm trying to implement functionality similar to Instagram where a user can double tap an image to "like" it. The issue is that ImageSlideShowItem already implements a double tap gesture to perform the zoom actions.
Would be great if you could pass a custom double tap for ImageSlideShow and then fallback to the tap to zoom when in full screen mode (or even just override default, pinch to zoom would still be avaliable)
+1 on this
Big +1 on this
Another Big +1 on this
Until this is officially added, you can workaround the incumbent double tap gesture recognizer, with something like:
let slideshowSubviews = imageSlideshowView.slideshowItems.compactMap({ $0.subviews }).reduce([], +)
slideshowSubviews.forEach { subview in
if let tapGestures = subview.gestureRecognizers?.filter({ $0 is UITapGestureRecognizer }) as? [UITapGestureRecognizer] {
let doubleTapGestures = tapGestures.filter { $0.numberOfTapsRequired == 2 }
doubleTapGestures.forEach { subview.removeGestureRecognizer($0) }
}
}
let doubleTap = UITapGestureRecognizer(target: self, action: #selector(handleDoubleTap))
doubleTap.numberOfTapsRequired = 2
doubleTap.numberOfTouchesRequired = 1
imageSlideshowView.addGestureRecognizer(doubleTap)
Disclosure: Not thoroughly tested - this could break other things 😛