UIPreviewInteraction
A class that registers a view to provide a custom user experience in response to 3D Touch interactions.
Declaration
@MainActor class UIPreviewInteractionOverview
A 3D Touch interaction results in a preview interaction that comprises two phases, the first also called preview, followed by commit. The interaction progresses through these phases as a person applies more force with a touch. The following image shows the relationship between the force of a person’s touch and the phases of the preview interaction.
[Image]
When using view controller previewing, peek represents the preview phase, and pop the commit phase.
A preview interaction is responsible for managing 3D Touch interactions for a specified view. It uses a delegate object to communicate the progress and status of the interaction to your code.
To use a preview interaction in your app:
Create a UIPreviewInteraction object, passing the view into the default initializer.
Create a delegate object that conforms to the UIPreviewInteractionDelegate protocol, and implement the appropriate methods.
Assign the delegate object to the delegate property on the preview interaction object.
For more information about the state transitions through which a preview interaction progresses, see UIPreviewInteractionDelegate.