AttachmentDefaultGuesturesModifier

@MainActor
public struct AttachmentDefaultGuesturesModifier : ViewModifier

A view modifier that adds default preview and delete gestures and actions to an attachment view.

AttachmentDefaultGuesturesModifier enables standard user interactions for attachment components, such as tapping to preview, accessibility actions for preview and delete, and a context menu with preview and delete options. The modifier adapts its behavior based on the attachment’s control state:

  • In .normal state, both preview and delete actions are available.
  • In .readOnly state, only preview is available.
  • In other states, actions are disabled.

This modifier is typically applied via the attachmentDefaultGuestures(configuration:) view extension.

Example Usage

AttachmentView(...)
    .attachmentDefaultGuestures(configuration: myAttachmentConfig)

Parameters

configuration

The configuration describing the attachment, its state, and the preview/delete callbacks.

  • Declaration

    Swift

    @MainActor
    public func body(content: Content) -> some View