Instance Method

dropInteraction(_:previewForDropping:withDefault:)

Asks the delegate for the targeted drag item preview to show during the drop animation.

Declaration

optional func dropInteraction(_ interaction: UIDropInteraction, previewForDropping item: UIDragItem, withDefault defaultPreview: UITargetedDragPreview) -> UITargetedDragPreview?

Parameters

interaction

The interaction that called this method.

item

The drag item represented by the preview.

defaultPreview

A targeted drag preview provided by the system.

Return Value

  • The default preview, which is the same behavior as not implementing this method.

  • A targeted drag item preview that you create.

  • The preview returned after moving to a new preview target (using the defaultPreview's retargetedPreview(with:) method).

  • nil to fade the preview that is currently displayed to the user.

Discussion

The system calls this method multiple times, once for each visible drag item. It shows the preview during the drop animation in order to visually “drop” the drag item into place.

See Also

Animating the Drop

func dropInteraction(UIDropInteraction, item: UIDragItem, willAnimateDropWith: UIDragAnimating)

Tells the delegate the system's drop animation is about to start.

func dropInteraction(UIDropInteraction, concludeDrop: UIDropSession)

Tells the delegate the drop activity and its related animations have finished.