<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/onDrop(of:isTargeted:perform:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE6onDrop2of10isTargeted7performQrSay22UniformTypeIdentifiers6UTTypeVG_AA7BindingVySbGSgSbSaySo14NSItemProviderCGctF::OverloadGroup"
  },
  "title" : "onDrop(of:isTargeted:perform:)"
}
-->

# onDrop(of:isTargeted:perform:)

Defines the destination of a drag-and-drop operation that handles the
dropped content with a closure that you specify.

```
nonisolated func onDrop(of supportedContentTypes: [UTType], isTargeted: Binding<Bool>?, perform action: @escaping ([NSItemProvider]) -> Bool) -> some View
```

## Parameters

`supportedContentTypes`

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 `isTargeted`
doesn’t update.

`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, and `false` when the cursor is outside.

`action`

A closure that takes the dropped content and responds
appropriately. The parameter to `action` contains the dropped
items, with types specified by `supportedContentTypes`. Return `true`
if the drop operation was successful; otherwise, return `false`.

## Return Value

A view that provides a drop destination for a drag
operation of the specified types.

## Discussion

The drop destination is the same size and position as this view.

Make sure to start loading the contents of `NSItemProvider` instances
within the scope of the `action` closure. Do not perform loading asynchronously
on a different actor. Loading the contents may finish later, but it must start here.
For security reasons, the drop receiver can access the dropped payload only before
this closure returns.

To use `Transferable` types directly and access a richer feature
set — including support for [`DropSession`](/documentation/SwiftUI/DropSession) — use
[`dropDestination(for:isEnabled:action:)`](/documentation/SwiftUI/View/dropDestination(for:isEnabled:action:)) instead.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)