One Logo Pool Ball
SwiftUI · IOS API REFERENCE

DragConfiguration

struct · iOS 26.0+ · SDK 27.1

struct DragConfiguration

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.

init · iOS 26.0+

init

TypeScript
static initOperationsWithinAppOperationsOutsideApp(operationsWithinApp?: DragConfiguration_OperationsWithinApp, operationsOutsideApp?: DragConfiguration_OperationsOutsideApp): DragConfiguration
Swift declaration
init(operationsWithinApp: DragConfiguration.OperationsWithinApp = .init(), operationsOutsideApp: DragConfiguration.OperationsOutsideApp = .init())

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

get · iOS 26.0+

operationsWithinApp

TypeScript
get operationsWithinApp(): DragConfiguration_OperationsWithinApp
Swift declaration
var operationsWithinApp: DragConfiguration.OperationsWithinApp { get set }

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

set · iOS 26.0+

operationsWithinApp

TypeScript
set operationsWithinApp(value: DragConfiguration_OperationsWithinApp)
Swift declaration
var operationsWithinApp: DragConfiguration.OperationsWithinApp { get set }

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

get · iOS 26.0+

operationsOutsideApp

TypeScript
get operationsOutsideApp(): DragConfiguration_OperationsOutsideApp
Swift declaration
var operationsOutsideApp: DragConfiguration.OperationsOutsideApp { get set }

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

set · iOS 26.0+

operationsOutsideApp

TypeScript
set operationsOutsideApp(value: DragConfiguration_OperationsOutsideApp)
Swift declaration
var operationsOutsideApp: DragConfiguration.OperationsOutsideApp { get set }

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

init · iOS 26.0+

init

TypeScript
static initAllowMove(allowMove: boolean): DragConfiguration
Swift declaration
init(allowMove: Bool)

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.

Skipped declarations

No declarations were skipped in this snapshot.

All SwiftUI types →