<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/dropDestination(for:isEnabled:action:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE15dropDestination3for9isEnabled6actionQrqd__m_SbySayqd__G_AA11DropSessionVtct16CoreTransferable0M0Rd__lF"
  },
  "title" : "dropDestination(for:isEnabled:action:)"
}
-->

# dropDestination(for:isEnabled:action:)

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

```
nonisolated func dropDestination<T>(for type: T.Type = T.self, isEnabled: Bool = true, action: @escaping ([T], DropSession) -> Void) -> some View where T : Transferable
```

## Parameters

`type`

The expected type of the dropped models.

`isEnabled`

The Boolean value indicating if the view accepts drop interactions.

`action`

A closure that takes the dropped content and responds
appropriately. The first parameter to `action` contains
the dropped items. The second parameter contains the drop session description.

## Return Value

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

## Discussion

The dropped content can be provided as binary data, file URLs, or file promises.

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

```
@State private var isDropTargeted = false
@Binding var isDropEnabled: Bool

var body: some View {
    Color.pink
        .frame(width: 400, height: 400)
        .dropDestination(
            for: String.self, isEnabled: isDropEnabled
        ) { receivedTitles, session in
            animateDrop(at: session.location)
            process(titles: receivedTitles)
        }
}

func process(titles: [String]) { ... }
func animateDrop(at: CGPoint) { ... }
```

---

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)