<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/draggable(_:preview:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE9draggable_7previewQrqd_0_yXA_qd__yXEtAaBRd__16CoreTransferable0G0Rd_0_r0_lF"
  },
  "title" : "draggable(_:preview:)"
}
-->

# draggable(_:preview:)

Activates this view as the source of a drag and drop operation.

```
nonisolated func draggable<V, T>(_ payload: @autoclosure @escaping () -> T, @ContentBuilder preview: () -> V) -> some View where V : View, T : Transferable
```

## Parameters

`payload`

A closure that returns a single
class instance or a value conforming to `Transferable` that
represents the draggable data from this view.

`preview`

A [`View`](/documentation/SwiftUI/View) to use as the source for the dragging
preview, once the drag operation has begun. The preview is centered over
the source view.

## Return Value

A view that activates this view as the source of a drag and
drop operation, beginning with user gesture input.

## Discussion

Applying the `draggable(_:preview:)` modifier adds the appropriate gestures
for drag and drop to this view. When a drag operation begins,
a rendering of `preview` is generated and used as the preview image.

```
var title: String
var body: some View {
Color.pink
    .frame(width: 400, height: 400)
    .draggable(title) {
         Text("Drop me")
     }
}
```

To customize the lift preview, shown while the system transitions
to show your custom `preview`, apply a [`contentShape(_:_:eoFill:)`](/documentation/SwiftUI/View/contentShape(_:_:eoFill:))
with a [`dragPreview`](/documentation/SwiftUI/ContentShapeKinds/dragPreview) kind. For example, you can
change the preview’s corner radius or use a nested view as the preview.

> Important: Don’t perform work on the main actor while exporting the
> item. Doing so isn’t supported and might cause a hang. Make sure
> `T`‘s exporting closure doesn’t dispatch to the main actor.

---

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)