<!--
{
  "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/DragConfiguration",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI17DragConfigurationV"
  },
  "title" : "DragConfiguration"
}
-->

# DragConfiguration

The behavior of the drag, proposed by the dragging source.
A value that describes the drag operations a drag source supports.

```
struct DragConfiguration
```

## Overview

Pass a `DragConfiguration` to the [`dragConfiguration(_:)`](/documentation/SwiftUI/View/dragConfiguration(_:))
modifier to declare which operations — copy, move, or delete —
a view supports when it is dragged.

### Opting in to move

By default, only copy is allowed. To support drag-to-move, where
the source item is removed after a successful drop, initialize
with `allowMove: true`:

```
.dragConfiguration(DragConfiguration(allowMove: true))
```

On macOS, users can override the proposed operation during a drag
by holding modifier keys:

- **⌥ (Option)** proposes copy.
- **⌘ (Command)** proposes move.
- **⌥ + ⌘** proposes alias.

Modifier keys only take effect when the source supports the
corresponding operation. For example, holding ⌘ has no effect
unless `allowMove` is `true`.

### Responding to the performed operation

`DragConfiguration` communicates *suggested* operations to drop
destinations, but each destination chooses which operation to
perform. To detect which operation was ultimately performed —
for example, to remove the source item after a successful move
— observe the drag session using
[`onDragSessionUpdated(_:)`](/documentation/SwiftUI/View/onDragSessionUpdated(_:)):

```
.dragConfiguration(DragConfiguration(allowMove: true))
.onDragSessionUpdated { session in
    if session.phase == .ended(.move) {
        removeItem()
    }
}
```

> SeeAlso: ``doc://com.apple.SwiftUI/documentation/SwiftUI/View/dragConfiguration(_:)``,
> ``doc://com.apple.SwiftUI/documentation/SwiftUI/View/onDragSessionUpdated(_:)``,
> ``doc://com.apple.SwiftUI/documentation/SwiftUI/DropSession/suggestedOperations``

## Topics

### Structures

[`struct OperationsOutsideApp`](/documentation/SwiftUI/DragConfiguration/OperationsOutsideApp-swift.struct)

Describes the suggested drag operations to other applications.

[`struct OperationsWithinApp`](/documentation/SwiftUI/DragConfiguration/OperationsWithinApp-swift.struct)

Describes the drag operations suggested to destinations within the app.

### Initializers

[`init(allowMove: Bool)`](/documentation/SwiftUI/DragConfiguration/init(allowMove:))

Creates a drag configuration that can support drag-to-move in addition
to drag-to-copy.

[`init(allowMove: Bool, allowDelete: Bool)`](/documentation/SwiftUI/DragConfiguration/init(allowMove:allowDelete:))

Creates a drag configuration that can support drag-to-move and
drag-to-delete in addition to drag-to-copy.

[`init(operationsWithinApp: DragConfiguration.OperationsWithinApp, operationsOutsideApp: DragConfiguration.OperationsOutsideApp)`](/documentation/SwiftUI/DragConfiguration/init(operationsWithinApp:operationsOutsideApp:))

Creates a default drag configuration with operation `.copy` support
for drags within the application and to other applications.

### Instance Properties

[`var operationsOutsideApp: DragConfiguration.OperationsOutsideApp`](/documentation/SwiftUI/DragConfiguration/operationsOutsideApp-swift.property)

The operations suggested by the drag source for drags to other applications.

[`var operationsWithinApp: DragConfiguration.OperationsWithinApp`](/documentation/SwiftUI/DragConfiguration/operationsWithinApp-swift.property)

The operations suggested by the drag source for drags within the application.

## Relationships

### Conforms To

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Copyable`](/documentation/Swift/Copyable)

[`Escapable`](/documentation/Swift/Escapable)

---

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)