Search code examples
iosuigesturerecognizer3dtouchphlivephoto

PHLivePhotoView and backwards compatibility with UILongPressGestureRecognizer


When using PHLivePhotoView, one does not need to add a 3D Touch gesture to this view to trigger playback of the Live Photo. This functionality is built right in. Also know that Live Photos can be played on devices that don't support 3D Touch, just by long pressing, for example in the Photos app.

My question is, does PHLivePhotoView also offer this backwards compatible functionality, or do I need to add a UILongPressGestureRecognizer and manually initiate Live Photo playback for non-compatible devices, like so?

livePhotoView.startPlaybackWithStyle(.Full)

Solution

  • I tested this with an old iPhone on iOS 9.2. I can confirm PHLivePhotoView automatically uses a UILongPressGestureRecognizer to trigger Live Photo playback for devices that aren't 3D Touch enabled. You do not need to implement this backwards compatibility manually.