DragConfigurationOperationsOutsideApp
Describes the suggested drag operations to other applications.
Declaration
type DragConfigurationOperationsOutsideApp = { allowCopy?: boolean; };struct OperationsOutsideAppType methods
Properties
allowCopyboolean
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.
From Apple’s SwiftUI documentation. Code samples there are Swift.
See also
More in Gestures and input.
- AutomaticHoverEffectThe default hover effect based on the surrounding context.
- CustomHoverEffectA type that represents how a view should change when a pointer hovers over a view, or when someone looks at the view.
- DragConfigurationThe behavior of the drag, proposed by the dragging source. A value that describes the drag operations a drag source supports.
- DragConfigurationOperationsWithinAppDescribes the drag operations suggested to destinations within the app.
- DragGestureA dragging motion that invokes an action as the drag-event sequence changes.
- DragGestureValueThe attributes of a drag gesture.
- DragSessionDescribes the ongoing dragging session.
- DragSessionIDThe identifier of a drag session.
- DragSessionPhaseThe phase of the current drag session
- GestureAn instance that matches a sequence of events to a gesture, and returns a stream of values for each of its states.
- GestureChainGesture with chained calls: SwiftUI.Gesture.exclusively(...).
- GestureInputKindsAn option set that specifies which input kinds a gesture should recognize.