The behavior of the drag, proposed by the dragging source.
A value that describes the drag operations a drag source supports.
Pass a `DragConfiguration` to the ``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
``View/onDragSessionUpdated(_:)``:
.dragConfiguration(DragConfiguration(allowMove: true))
.onDragSessionUpdated { session in
if session.phase == .ended(.move) {
removeItem()
}
}
- SeeAlso: ``View/dragConfiguration(_:)``,
``View/onDragSessionUpdated(_:)``,
``DropSession/suggestedOperations``
Members (7)
get · iOS 26.0+
debugDescription
TypeScript
get debugDescription(): string
Swift declaration
var debugDescription: String { get }
A textual representation of this instance, suitable for debugging.
Calling this property directly is discouraged. Instead, convert an
instance of any type to a string by using the `String(reflecting:)`
initializer. This initializer works with any type, and uses the custom
`debugDescription` property for types that conform to
`CustomDebugStringConvertible`:
struct Point: CustomDebugStringConvertible {
let x: Int, y: Int
var debugDescription: String {
return "(\(x), \(y))"
}
}
let p = Point(x: 21, y: 30)
let s = String(reflecting: p)
print(s)
// Prints "(21, 30)"
The conversion of `p` to a string in the assignment to `s` uses the
`Point` type's `debugDescription` property.
Creates a drag configuration that can support drag-to-move in addition
to drag-to-copy.
iOS supports drag-to-move operations only within an application.
On macOS, an item can be dragged to move both within the app and to other apps.