Gizmodo
Gizmodo

Reputation: 3222

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?

Upvotes: 1

Views: 937

Answers (2)

matt
matt

Reputation: 535138

UIContextMenuInteraction is an exact replacement. You don't have to put up a menu; you can put up just a custom preview. And that preview is a snapshot of a view controller's view, and you provide that view controller. And the user can then tap the preview to perform an actual view controller transition. So this is the exact analog of peek-and-pop with view controllers.

Upvotes: 1

93sauu
93sauu

Reputation: 4107

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

Upvotes: 1

Related Questions