Registers a view controller to participate with 3D Touch preview (peek) and commit (pop).
- iOS 9.0+
- tvOS 9.0+
The delegate object mediates the presentation of views from the preview (peek) view controller and the commit (pop) view controller. In practice, these two are typically the same view controller. The delegate performs this mediation through your implementation of the methods of the
Controller Previewing Delegate
The view, in the view hierarchy of the receiver of this method call, that invokes a preview when pressed by the user.
When lightly pressed, the source view remains visually sharp while surrounding content blurs. When pressed more deeply, the system calls the
previewingmethod in your
Context(_: view Controller For Location:)
delegateobject, which presents the preview (peek) view from another view controller.
A context object for managing the preview. This object conforms to the
A preview, or peek in end-user terminology, provides additional content related to the view the user pressed (that is, related to the
Calling this method does three things:
Registers the previewing view controller (the one that receives this method call) to participate with 3D Touch preview and commit
Designates the source view, from the receiver’s view hierarchy, as the view to respond to a forceful touch
Designates a delegate object for mediating the presentation of the preview (peek) and commit (pop) views as a user requests them in turn by pressing more deeply
You can designate more than one source view for a single registered view controller, but you cannot designate a single view as a source view more than once.
The lifetime of this method’s returned context object is managed by the system. If you need to explicitly unregister a view controller, pass its context object to the
unregister method. If you do not unregister a view controller, the system automatically unregisters it when the view controller is deallocated.