A class that registers a view to provide a custom user experience in response to 3D Touch interactions.
- iOS 10.0+
- Mac Catalyst 13.0+
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 the user applies more force with a touch. Figure 1 shows the relationship between the force of the user's touch and the phases of the preview interaction.
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:
UIPreviewobject, passing the view into the default initializer.
Create a delegate object that conforms to the
UIPreviewprotocol, and implement the appropriate methods.
Assign the delegate object to the
delegateproperty on the preview interaction object.
For more information about the state transitions through which a preview interaction progresses, see