Contents

DragConfiguration.OperationsOutsideApp

Describes the suggested drag operations to other applications.

Declaration

struct OperationsOutsideApp

Overview

To create a default configuration, initialize it without parameters.

On iOS, the default behavior is to disallow drag outside the application. On macOS—support drag-to-copy to destinations both within the application and to other apps.

In addition to copy, add move operation support by specifying that in the initializer:

struct DraggableBookView: View {
    var id: UUID

    var body: some View {
        BookView()
            .draggable(Book(id: id))
            .dragConfiguration(makeConfiguration())
    }

    func makeConfiguration() -> DragConfiguration {
        let operations = OperationsOutsideApp(
            allowCopy: true, allowMove: true
        )
        return DragConfiguration(operationsOutsideApp: operations)
    }
}

In the example above, an application provides operations that will be suggested to other applications. Drags to destinations within the app will use the default behavior: suggest operation copy to drag destinations.

Topics

Initializers

Instance Properties