---
title: "draggable(_:preview:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/draggable(_:preview:)"
---

# draggable(_:preview:)

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

## Declaration

```swift
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 doc://com.apple.SwiftUI/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.

## Mentioned in

Making a view into a drag source

## Return Value

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

## Discussion

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:) with a dragPreview kind. For example, you can change the preview’s corner radius or use a nested view as the preview.

## See Also

### Moving transferable items

- [draggable(_:)](swiftui/view/draggable(_:).md)
- [draggable(_:containerNamespace:_:)](swiftui/view/draggable(_:containernamespace:_:).md)
- [draggable(_:id:containerNamespace:_:)](swiftui/view/draggable(_:id:containernamespace:_:).md)
- [draggable(_:id:item:containerNamespace:)](swiftui/view/draggable(_:id:item:containernamespace:).md)
- [draggable(_:item:containerNamespace:)](swiftui/view/draggable(_:item:containernamespace:).md)
- [draggable(containerItemID:containerNamespace:)](swiftui/view/draggable(containeritemid:containernamespace:).md)
