One Logo Pool Ball
SwiftUI · IOS API REFERENCE

DropDelegate

protocol · iOS 13.4+ · SDK 27.1

@MainActor @preconcurrency protocol DropDelegate

An interface that you implement to interact with a drop operation in a view modified to accept drops. The ``DropDelegate`` protocol provides a comprehensive and flexible way to interact with a drop operation. Specify a drop delegate when you modify a view to accept drops with the ``View/onDrop(of:delegate:)`` method. Alternatively, for simple drop cases that don't require the full functionality of a drop delegate, you can modify a view to accept drops using the ``View/onDrop(of:isTargeted:perform:)`` method. This method handles the drop using a closure you provide as part of the modifier.

Members (4)

method · iOS 13.4+

validateDrop

Swift declaration
@MainActor @preconcurrency func validateDrop(info: DropInfo) -> Bool

Tells the delegate that a drop containing items conforming to one of the expected types entered a view that accepts drops. Specify the expected types when you apply the drop modifier to the view. The default implementation returns `true`.

method · iOS 13.4+

dropExited

Swift declaration
@MainActor @preconcurrency func dropExited(info: DropInfo)

Tells the delegate a validated drop operation has exited the modified view. The default implementation does nothing.

method · iOS 13.4+

dropEntered

Swift declaration
@MainActor @preconcurrency func dropEntered(info: DropInfo)

Tells the delegate a validated drop has entered the modified view. The default implementation does nothing.

method · iOS 13.4+

dropUpdated

Swift declaration
@MainActor @preconcurrency func dropUpdated(info: DropInfo) -> DropProposal?

Tells the delegate that a validated drop moved inside the modified view. Use this method to return a drop proposal containing the operation the delegate intends to perform at the drop ``DropInfo/location``. The default implementation of this method returns `nil`, which tells the drop to use the last valid returned value or else ``DropOperation/copy``.

Skipped declarations

No declarations were skipped in this snapshot.

All SwiftUI types →