Search code examples
iosxcodeuitouch3dtouchhaptic-feedback

iOS Haptic Touch API Possibilities


Since we are losing 3D Touch API's with iOS 13, such as UIViewControllerPreviewing, UIContextMenuInteraction seems to be the replacement.

UIContextMenuInteraction is good if you want to put up a menu upon Haptic Touch. What if you want to do something else at the recognition of Haptic Touch?

Is there such a thing? Or is Haptic Touch is same as UILongPressGesture?


Solution

  • Reading the documentation UIContextMenuInteraction inherits from UIInteraction. Searching for all subclasses:

    • UIContextMenuInteraction
    • UIDragInteraction
    • UIDropInteraction
    • UILargeContentViewerInteraction
    • UIPencilInteraction
    • UISpringLoadedInteraction
    • UITextInteraction

    Reviewing each subclass I think that the one that best suits to replace UIViewControllerPreviewing is UILargeContentViewerInteraction because UILargeContentViewerInteractionDelegate has a method to return a view controller.

    UIViewControllerPreviewing

    UIContextMenuInteraction

    UIInteraction

    UILargeContentViewerInteractionDelegate