Overloads
7 ways to call compose().draggable(). Each is one SwiftUI overload, picked by the arguments you pass.
compose().draggable<T>(payload: T)nonisolated func draggable<T>(
_ payload: @autoclosure @escaping () -> T
) -> some View
where T : TransferableParameters
payload*TA closure that returns a single
Return value
A view that activates this view as the source of a drag and drop operation, beginning with user gesture input.
Discussion
Applying the draggable(_:) modifier adds the appropriate gestures for
drag and drop to this view. When a drag operation begins, a rendering of
this view is generated and used as the preview image.
To customize the default preview, apply a
View.contentShape(_:_:eoFill:) with a
ContentShapeKinds.dragPreview kind. For example, you can change the
preview's corner radius or use a nested view as the preview.
instance or a value conforming to doc://com.apple.documentation/documentation/coretransferable/transferable that represents the draggable data from this view.
See also
More in Drag and drop.
- copyableSpecifies a list of items to copy in response to the system's Copy command.
- cuttableSpecifies an action that moves items to the Clipboard in response to the system's Cut command.
- documentLaunchSubtitleSets the subtitle displayed beneath the title on the document launch card, using a localized string resource.
- documentLaunchTitleSets the title displayed on the document launch card, using a localized string resource.
- dropConfigurationConfigures a drop session.
- dropDestinationDefines the destination of a drag and drop operation that provides a drop operation proposal and handles the dropped content with a closure that you specify.
- fileExporterPresents a system dialog allowing the user to export a Transferable item to a file on disk.
- fileExporterFilenameLabelOn macOS, configures the fileExporter with a label for the file name field.
- fileImporterPresents a system dialog for allowing the user to import multiple files.
- fileMoverPresents a system dialog for allowing the user to move an existing file to a new location.
- itemProviderProvides a closure that vends the drag representation to be used for a particular data element.
- pasteDestinationSpecifies an action that adds validated items to a view in response to the system's Paste command.