Defines the destination of a drag and drop operation with the same size and position as the view by handling dropped content and the drop location with the specified closure.
SDKs
- macOS 10.15+
- Xcode 11.0+
Framework
- Swift
UI
Declaration
Parameters
supportedTypes
The uniform type identifiers that describe the types of content this view can accept through drag and drop. If the drag and drop operation doesn’t contain any of the supported types, then this drop destination doesn’t activate and
is
doesn’t update.Targeted isTargeted
A binding that updates when a drag and drop operation enters or exits the drop target area. The binding’s value is
true
when the cursor is inside the area, andfalse
when the cursor is outside.action
A closure that takes the dropped content and responds appropriately. The first parameter to
action
contains the dropped items, with types specified bysupported
. The second parameter contains the drop location in this view’s coordinate space. ReturnTypes true
if the drop operation was successful; otherwise, returnfalse
.
Return Value
A view that provides a drop destination for a drag operation of the specified types.