<!--
{
  "documentType" : "article",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View-Input-and-Events",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Input and event modifiers"
}
-->

# Input and event modifiers

Supply actions for a view to perform in response to user input and system events.

## Overview

Use input and event modifiers to configure and provide handlers for a
wide variety of user inputs or system events. For example, you can detect
and control focus, respond to life cycle events like view appearance and
disappearance, manage keyboard shortcuts, and much more.

## Topics

### Interactivity

[`disabled(_:)`](/documentation/SwiftUI/View/disabled(_:))

Adds a condition that controls whether users can interact with this
view.

[`interactionActivityTrackingTag(_:)`](/documentation/SwiftUI/View/interactionActivityTrackingTag(_:))

Sets a tag that you use for tracking interactivity.

### List controls

[`swipeActions(edge:allowsFullSwipe:content:)`](/documentation/SwiftUI/View/swipeActions(edge:allowsFullSwipe:content:))

Adds custom swipe actions to a row in a list.

[`refreshable(action:)`](/documentation/SwiftUI/View/refreshable(action:))

Adds an asynchronous handler that can update the data the view
displays when a person initiates a request, such as by pulling to refresh.

[`selectionDisabled(_:)`](/documentation/SwiftUI/View/selectionDisabled(_:))

Adds a condition that controls whether users can select this view.

### Container controls

[`swipeActions(edge:allowsFullSwipe:content:onPresentationChanged:)`](/documentation/SwiftUI/View/swipeActions(edge:allowsFullSwipe:content:onPresentationChanged:))

Adds custom swipe actions to a row in a list or container,
notifying you when the actions are revealed or dismissed.

[`swipeActionsContainer()`](/documentation/SwiftUI/View/swipeActionsContainer())

Coordinates swipe action dismissal and mutual
exclusion across rows in a container.

### Scroll controls

[`scrollPosition(_:anchor:)`](/documentation/SwiftUI/View/scrollPosition(_:anchor:))

Associates a binding to a scroll position with a scroll view within this
view.

[`scrollPosition(id:anchor:)`](/documentation/SwiftUI/View/scrollPosition(id:anchor:))

Associates a binding to be updated when a scroll view within this
view scrolls.

[`defaultScrollAnchor(_:)`](/documentation/SwiftUI/View/defaultScrollAnchor(_:))

Associates an anchor to control which part of the scroll view’s
content should be rendered by default.

[`defaultScrollAnchor(_:for:)`](/documentation/SwiftUI/View/defaultScrollAnchor(_:for:))

Associates an anchor to control the position of a scroll view in a
particular circumstance.

[`scrollTargetBehavior(_:)`](/documentation/SwiftUI/View/scrollTargetBehavior(_:))

Sets the scroll behavior of views scrollable in the provided axes.

[`scrollTargetLayout(isEnabled:)`](/documentation/SwiftUI/View/scrollTargetLayout(isEnabled:))

Configures the outermost layout as a scroll target layout.

[`scrollInputBehavior(_:for:)`](/documentation/SwiftUI/View/scrollInputBehavior(_:for:))

Enables or disables scrolling in scrollable views when using particular
inputs.

[`scrollTransition(_:axis:transition:)`](/documentation/SwiftUI/View/scrollTransition(_:axis:transition:))

Applies the given transition, animating between the phases
of the transition as this view appears and disappears within the
visible region of the containing scroll view.

[`scrollTransition(topLeading:bottomTrailing:axis:transition:)`](/documentation/SwiftUI/View/scrollTransition(topLeading:bottomTrailing:axis:transition:))

Applies the given transition, animating between the phases
of the transition as this view appears and disappears within the
visible region of the containing scroll view.

[`onScrollGeometryChange(for:of:action:)`](/documentation/SwiftUI/View/onScrollGeometryChange(for:of:action:))

Adds an action to be performed when a value, created from a
scroll geometry, changes.

[`onScrollTargetVisibilityChange(idType:threshold:_:)`](/documentation/SwiftUI/View/onScrollTargetVisibilityChange(idType:threshold:_:))

Adds an action to be called with information about what views would
be considered visible.

[`onScrollVisibilityChange(threshold:_:)`](/documentation/SwiftUI/View/onScrollVisibilityChange(threshold:_:))

Adds an action to be called when the view crosses the threshold to be considered on/off screen.

[`onScrollPhaseChange(_:)`](/documentation/SwiftUI/View/onScrollPhaseChange(_:))

Adds an action to perform when the scroll phase of the first scroll
view in the hierarchy changes.

### Geometry

[`onGeometryChange(for:of:action:)`](/documentation/SwiftUI/View/onGeometryChange(for:of:action:))

Adds an action to be performed when a value, created from a
geometry proxy, changes.

[`onGeometryChange3D(for:of:action:)`](/documentation/SwiftUI/View/onGeometryChange3D(for:of:action:))

Returns a new view that arranges to call `action(value)`
whenever the value computed by `transform(proxy)` changes, where
`proxy` provides access to the view’s 3D geometry properties.

[`onInteractiveResizeChange(_:)`](/documentation/SwiftUI/View/onInteractiveResizeChange(_:))

Adds an action to perform when the enclosing window is being
interactively resized.

### Taps and gestures

For more information, see [Gestures](/documentation/SwiftUI/Gestures)

Define interactions from taps, clicks, and swipes to fine-grained gestures..

[`onTapGesture(count:perform:)`](/documentation/SwiftUI/View/onTapGesture(count:perform:))

Adds an action to perform when this view recognizes a tap gesture.

[`onTapGesture(count:coordinateSpace:perform:)`](/documentation/SwiftUI/View/onTapGesture(count:coordinateSpace:perform:))

Adds an action to perform when this view recognizes a tap gesture,
and provides the action with the location of the interaction.

[`onTapGesture(count:coordinateSpace:inputKinds:perform:)`](/documentation/SwiftUI/View/onTapGesture(count:coordinateSpace:inputKinds:perform:))

Adds an action to perform when this view recognizes a tap gesture,
and provides the action with the location of the interaction.

[`onLongPressGesture(minimumDuration:maximumDistance:perform:onPressingChanged:)`](/documentation/SwiftUI/View/onLongPressGesture(minimumDuration:maximumDistance:perform:onPressingChanged:))

Adds an action to perform when this view recognizes a long press
gesture.

[`onLongPressGesture(minimumDuration:maximumDistance:inputKinds:perform:onPressingChanged:)`](/documentation/SwiftUI/View/onLongPressGesture(minimumDuration:maximumDistance:inputKinds:perform:onPressingChanged:))

Adds an action to perform when this view recognizes a long press
gesture.

[`onLongPressGesture(minimumDuration:perform:onPressingChanged:)`](/documentation/SwiftUI/View/onLongPressGesture(minimumDuration:perform:onPressingChanged:))

Adds an action to perform when this view recognizes a long press
gesture.

[`onLongTouchGesture(minimumDuration:perform:onTouchingChanged:)`](/documentation/SwiftUI/View/onLongTouchGesture(minimumDuration:perform:onTouchingChanged:))

Adds an action to perform when this view recognizes a
remote long touch gesture. A long touch gesture is when the finger is
on the remote touch surface without actually pressing.

[`gesture(_:)`](/documentation/SwiftUI/View/gesture(_:))

Attaches an [`NSGestureRecognizerRepresentable`](/documentation/SwiftUI/NSGestureRecognizerRepresentable) to the view.

[`gesture(_:isEnabled:)`](/documentation/SwiftUI/View/gesture(_:isEnabled:))

Attaches a gesture to the view with a lower precedence than gestures
defined by the view.

[`gesture(_:name:isEnabled:)`](/documentation/SwiftUI/View/gesture(_:name:isEnabled:))

Attaches a gesture to the view with a lower precedence than gestures
defined by the view.

[`gesture(_:including:)`](/documentation/SwiftUI/View/gesture(_:including:))

Attaches a gesture to the view with a lower precedence than gestures
defined by the view.

[`highPriorityGesture(_:including:)`](/documentation/SwiftUI/View/highPriorityGesture(_:including:))

Attaches a gesture to the view with a higher precedence than gestures
defined by the view.

[`highPriorityGesture(_:isEnabled:)`](/documentation/SwiftUI/View/highPriorityGesture(_:isEnabled:))

Attaches a gesture to the view with a higher precedence than gestures
defined by the view.

[`highPriorityGesture(_:name:isEnabled:)`](/documentation/SwiftUI/View/highPriorityGesture(_:name:isEnabled:))

Attaches a gesture to the view with a higher precedence than gestures
defined by the view.

[`simultaneousGesture(_:including:)`](/documentation/SwiftUI/View/simultaneousGesture(_:including:))

Attaches a gesture to the view to process simultaneously with gestures
defined by the view.

[`simultaneousGesture(_:isEnabled:)`](/documentation/SwiftUI/View/simultaneousGesture(_:isEnabled:))

Attaches a gesture to the view to process simultaneously with gestures
defined by the view.

[`simultaneousGesture(_:name:isEnabled:)`](/documentation/SwiftUI/View/simultaneousGesture(_:name:isEnabled:))

Attaches a gesture to the view to process simultaneously with gestures
defined by the view.

[`defersSystemGestures(on:)`](/documentation/SwiftUI/View/defersSystemGestures(on:))

Sets the screen edge from which you want your gesture to take
precedence over the system gesture.

[`onPencilDoubleTap(perform:)`](/documentation/SwiftUI/View/onPencilDoubleTap(perform:))

Adds an action to perform after the user double-taps their Apple Pencil.

[`onPencilSqueeze(perform:)`](/documentation/SwiftUI/View/onPencilSqueeze(perform:))

Adds an action to perform when the user squeezes their Apple Pencil.

[`allowsWindowActivationEvents()`](/documentation/SwiftUI/View/allowsWindowActivationEvents())

Configures gestures in this view hierarchy to handle events that
activate the containing window.

[`allowsWindowActivationEvents(_:)`](/documentation/SwiftUI/View/allowsWindowActivationEvents(_:))

Configures whether gestures in this view hierarchy can handle events
that activate the containing window.

### Keyboard input

[`onKeyPress(_:action:)`](/documentation/SwiftUI/View/onKeyPress(_:action:))

Performs an action if the user presses a key on a hardware keyboard
while the view has focus.

[`onKeyPress(phases:action:)`](/documentation/SwiftUI/View/onKeyPress(phases:action:))

Performs an action if the user presses any key on a hardware keyboard
while the view has focus.

[`onKeyPress(_:phases:action:)`](/documentation/SwiftUI/View/onKeyPress(_:phases:action:))

Performs an action if the user presses a key on a hardware keyboard
while the view has focus.

[`onKeyPress(characters:phases:action:)`](/documentation/SwiftUI/View/onKeyPress(characters:phases:action:))

Performs an action if the user presses one or more keys on a hardware
keyboard while the view has focus.

[`onKeyPress(keys:phases:action:)`](/documentation/SwiftUI/View/onKeyPress(keys:phases:action:))

Performs an action if the user presses one or more keys on a hardware
keyboard while the view has focus.

[`onModifierKeysChanged(mask:initial:_:)`](/documentation/SwiftUI/View/onModifierKeysChanged(mask:initial:_:))

Performs an action whenever the user presses or releases a hardware
modifier key.

### Keyboard shortcuts

[`keyboardShortcut(_:)`](/documentation/SwiftUI/View/keyboardShortcut(_:))

Assigns a keyboard shortcut to the modified control.

[`keyboardShortcut(_:modifiers:)`](/documentation/SwiftUI/View/keyboardShortcut(_:modifiers:))

Defines a keyboard shortcut and assigns it to the modified control.

[`keyboardShortcut(_:modifiers:localization:)`](/documentation/SwiftUI/View/keyboardShortcut(_:modifiers:localization:))

Defines a keyboard shortcut and assigns it to the modified control.

[`modifierKeyAlternate(_:_:)`](/documentation/SwiftUI/View/modifierKeyAlternate(_:_:))

Builds a view to use in place of the modified view when the user presses
the modifier key(s) indicated by the given set.

### Hand interactions

[`handGestureShortcut(_:isEnabled:)`](/documentation/SwiftUI/View/handGestureShortcut(_:isEnabled:))

Assigns a hand gesture shortcut to the modified control.

[`handPointerBehavior(_:)`](/documentation/SwiftUI/View/handPointerBehavior(_:))

Sets the behavior of the hand pointer while the user is interacting with
the view.

[`manipulable(coordinateSpace:operations:inertia:isEnabled:onChanged:)`](/documentation/SwiftUI/View/manipulable(coordinateSpace:operations:inertia:isEnabled:onChanged:))

Allows this view to be manipulated using common hand gestures.

[`manipulable(transform:coordinateSpace:operations:inertia:isEnabled:onChanged:)`](/documentation/SwiftUI/View/manipulable(transform:coordinateSpace:operations:inertia:isEnabled:onChanged:))

Applies the given 3D affine transform to the view and allows it to be
manipulated using common hand gestures.

[`manipulable(using:)`](/documentation/SwiftUI/View/manipulable(using:))

Allows the view to be manipulated using a manipulation gesture attached
to a different view.

[`manipulationGesture(updating:coordinateSpace:operations:inertia:isEnabled:onChanged:)`](/documentation/SwiftUI/View/manipulationGesture(updating:coordinateSpace:operations:inertia:isEnabled:onChanged:))

Adds a manipulation gesture to this view without allowing this view
to be manipulable itself.

### Hover

[`onHover(perform:)`](/documentation/SwiftUI/View/onHover(perform:))

Adds an action to perform when the user moves the pointer over or away
from the view’s frame.

[`onContinuousHover(coordinateSpace:perform:)`](/documentation/SwiftUI/View/onContinuousHover(coordinateSpace:perform:))

Adds an action to perform when the pointer enters, moves within, and
exits the view’s bounds.

[`hoverEffect(_:)`](/documentation/SwiftUI/View/hoverEffect(_:))

Applies a hover effect to this view.

[`hoverEffect(_:isEnabled:)`](/documentation/SwiftUI/View/hoverEffect(_:isEnabled:))

Applies a hover effect to this view.

[`hoverEffect(_:in:isEnabled:)`](/documentation/SwiftUI/View/hoverEffect(_:in:isEnabled:))

Applies a hover effect to this view, optionally adding it to a
[`HoverEffectGroup`](/documentation/SwiftUI/HoverEffectGroup).

[`hoverEffect(in:isEnabled:body:)`](/documentation/SwiftUI/View/hoverEffect(in:isEnabled:body:))

Applies a hover effect to this view described by the given closure.

[`hoverEffectGroup()`](/documentation/SwiftUI/View/hoverEffectGroup())

Adds an implicit [`HoverEffectGroup`](/documentation/SwiftUI/HoverEffectGroup) to all effects defined on
descendant views, so that all effects added to subviews activate as a
group whenever this view or any descendant views are hovered.

[`hoverEffectGroup(_:)`](/documentation/SwiftUI/View/hoverEffectGroup(_:))

Adds a [`HoverEffectGroup`](/documentation/SwiftUI/HoverEffectGroup) to all effects defined on descendant views,
and activates the group whenever this view or any descendant views are
hovered.

[`hoverEffectGroup(id:in:behavior:)`](/documentation/SwiftUI/View/hoverEffectGroup(id:in:behavior:))

Adds a [`HoverEffectGroup`](/documentation/SwiftUI/HoverEffectGroup) to all effects defined on descendant views,
and activates the group whenever this view or any descendant views are
hovered.

[`hoverEffectDisabled(_:)`](/documentation/SwiftUI/View/hoverEffectDisabled(_:))

Adds a condition that controls whether this view can display hover
effects.

[`defaultHoverEffect(_:)`](/documentation/SwiftUI/View/defaultHoverEffect(_:))

Sets the default hover effect to use for views within this view.

[`listRowHoverEffect(_:)`](/documentation/SwiftUI/View/listRowHoverEffect(_:))

Requests that the containing list row use the provided hover effect.

[`listRowHoverEffectDisabled(_:)`](/documentation/SwiftUI/View/listRowHoverEffectDisabled(_:))

Requests that the containing list row have its hover effect disabled.

### Pointer

[`pointerVisibility(_:)`](/documentation/SwiftUI/View/pointerVisibility(_:))

Sets the visibility of the pointer when it’s over the view.

[`pointerStyle(_:)`](/documentation/SwiftUI/View/pointerStyle(_:))

Sets the pointer style to display when the pointer is over the view.

### Focus

For more information, see [Focus](/documentation/SwiftUI/Focus)

Identify and control which visible object responds to user interaction..

[`focused(_:equals:)`](/documentation/SwiftUI/View/focused(_:equals:))

Modifies this view by binding its focus state to the given state value.

[`focused(_:)`](/documentation/SwiftUI/View/focused(_:))

Modifies this view by binding its focus state to the given Boolean state
value.

[`focusedValue(_:)`](/documentation/SwiftUI/View/focusedValue(_:))

Sets the focused value for the given object type.

[`focusedValue(_:_:)`](/documentation/SwiftUI/View/focusedValue(_:_:))

Modifies this view by injecting a value that you provide for use by
other views whose state depends on the focused view hierarchy.

[`focusedSceneValue(_:)`](/documentation/SwiftUI/View/focusedSceneValue(_:))

Sets the focused value for the given object type at a scene-wide scope.

[`focusedSceneValue(_:_:)`](/documentation/SwiftUI/View/focusedSceneValue(_:_:))

Modifies this view by injecting a value that you provide for use by
other views whose state depends on the focused scene.

[`focusedObject(_:)`](/documentation/SwiftUI/View/focusedObject(_:))

Creates a new view that exposes the provided object to other views whose
whose state depends on the focused view hierarchy.

[`focusedSceneObject(_:)`](/documentation/SwiftUI/View/focusedSceneObject(_:))

Creates a new view that exposes the provided object to other views whose
whose state depends on the active scene.

[`prefersDefaultFocus(_:in:)`](/documentation/SwiftUI/View/prefersDefaultFocus(_:in:))

Indicates that the view should receive focus by default for a given
namespace.

[`focusScope(_:)`](/documentation/SwiftUI/View/focusScope(_:))

Creates a focus scope that SwiftUI uses to limit default focus
preferences.

[`focusSection()`](/documentation/SwiftUI/View/focusSection())

Indicates that the view’s frame and cohort of focusable descendants
should be used to guide focus movement.

[`focusable(_:)`](/documentation/SwiftUI/View/focusable(_:))

Specifies if the view is focusable.

[`focusable(_:interactions:)`](/documentation/SwiftUI/View/focusable(_:interactions:))

Specifies if the view is focusable, and if so, what focus-driven
interactions it supports.

[`focusEffectDisabled(_:)`](/documentation/SwiftUI/View/focusEffectDisabled(_:))

Adds a condition that controls whether this view can display focus
effects, such as a default focus ring or hover effect.

[`defaultFocus(_:_:priority:)`](/documentation/SwiftUI/View/defaultFocus(_:_:priority:))

Defines a region of the window in which default focus is evaluated by
assigning a value to a given focus state binding.

[`searchFocused(_:)`](/documentation/SwiftUI/View/searchFocused(_:))

Modifies this view by binding the focus state of the search field
associated with the nearest searchable modifier to the given
Boolean value.

[`searchFocused(_:equals:)`](/documentation/SwiftUI/View/searchFocused(_:equals:))

Modifies this view by binding the focus state of the search field
associated with the nearest searchable modifier to the given value.

### Copy and paste

For more information, see [Clipboard](/documentation/SwiftUI/Clipboard)

Enable people to move or duplicate items by issuing Copy and Paste commands..

[`copyable(_:)`](/documentation/SwiftUI/View/copyable(_:))

Specifies a list of items to copy in response to the system’s Copy
command.

[`cuttable(for:action:)`](/documentation/SwiftUI/View/cuttable(for:action:))

Specifies an action that moves items to the Clipboard in response to
the system’s Cut command.

[`pasteDestination(for:action:validator:)`](/documentation/SwiftUI/View/pasteDestination(for:action:validator:))

Specifies an action that adds validated items to a view in response to
the system’s Paste command.

[`onCopyCommand(perform:)`](/documentation/SwiftUI/View/onCopyCommand(perform:))

Adds an action to perform in response to the system’s Copy command.

[`onCutCommand(perform:)`](/documentation/SwiftUI/View/onCutCommand(perform:))

Adds an action to perform in response to the system’s Cut command.

[`onPasteCommand(of:perform:)`](/documentation/SwiftUI/View/onPasteCommand(of:perform:))

Adds an action to perform in response to the system’s Paste command.

[`onPasteCommand(of:validator:perform:)`](/documentation/SwiftUI/View/onPasteCommand(of:validator:perform:))

Adds an action to perform in response to the system’s Paste command with
items that you validate.

### Drag and drop

For more information, see [Drag and drop](/documentation/SwiftUI/Drag-and-drop)

Enable people to move or duplicate items by dragging them from one location to another..

[`dragConfiguration(_:)`](/documentation/SwiftUI/View/dragConfiguration(_:))

Configures a drag session.

[`dragContainer(for:in:_:)`](/documentation/SwiftUI/View/dragContainer(for:in:_:))

A container with draggable views where the drag payload is based
on multiple identifiers of dragged items.

[`dragContainer(for:itemID:in:_:)`](/documentation/SwiftUI/View/dragContainer(for:itemID:in:_:))

A container with draggable views.

[`dragContainerSelection(_:containerNamespace:)`](/documentation/SwiftUI/View/dragContainerSelection(_:containerNamespace:))

Provides multiple item selection support for drag containers.

[`dragPreviewsFormation(_:)`](/documentation/SwiftUI/View/dragPreviewsFormation(_:))

Describes the way dragged previews are visually composed.

[`draggable(_:)`](/documentation/SwiftUI/View/draggable(_:))

Activates this view as the source of a drag and drop operation.

[`draggable(_:preview:)`](/documentation/SwiftUI/View/draggable(_:preview:))

Activates this view as the source of a drag and drop operation.

[`draggable(_:containerNamespace:_:)`](/documentation/SwiftUI/View/draggable(_:containerNamespace:_:))

Activates this view as the source of a drag and drop operation,
allowing to provide optional identifiable
payload and specify the namespace of the drag container this view
belongs to.

[`draggable(_:id:containerNamespace:_:)`](/documentation/SwiftUI/View/draggable(_:id:containerNamespace:_:))

Activates this view as the source of a drag and drop operation, allowing
to provide optional payload and specify the namespace
of the drag container this view belongs to.

[`draggable(_:id:item:containerNamespace:)`](/documentation/SwiftUI/View/draggable(_:id:item:containerNamespace:))

Activates this view as the source of a drag and drop operation,
allowing to provide optional payload and specify the namespace of
the drag container this view belongs to.

[`draggable(_:item:containerNamespace:)`](/documentation/SwiftUI/View/draggable(_:item:containerNamespace:))

Activates this view as the source of a drag and drop operation, allowing
to provide optional identifiable payload and specify the namespace
of the drag container this view belongs to.

[`draggable(containerItemID:containerNamespace:)`](/documentation/SwiftUI/View/draggable(containerItemID:containerNamespace:))

Inside a drag container, activates this view as the source
of a drag and drop operation. Supports lazy drag containers.

[`dropConfiguration(_:)`](/documentation/SwiftUI/View/dropConfiguration(_:))

Configures a drop session.

[`dropDestination(for:isEnabled:action:)`](/documentation/SwiftUI/View/dropDestination(for:isEnabled:action:))

Defines 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.

[`dropPreviewsFormation(_:)`](/documentation/SwiftUI/View/dropPreviewsFormation(_:))

Describes the way previews for a drop are composed.

[`itemProvider(_:)`](/documentation/SwiftUI/View/itemProvider(_:))

Provides a closure that vends the drag representation to be used for a
particular data element.

[`onDrag(_:preview:)`](/documentation/SwiftUI/View/onDrag(_:preview:))

Activates this view as the source of a drag and drop operation.

[`onDrag(_:)`](/documentation/SwiftUI/View/onDrag(_:))

Activates this view as the source of a drag and drop operation.

[`onDragSessionUpdated(_:)`](/documentation/SwiftUI/View/onDragSessionUpdated(_:))

Specifies an action to perform on each update of an ongoing dragging operation
activated by `draggable(_:)` or anther drag modifiers.

[`onDrop(of:isTargeted:perform:)`](/documentation/SwiftUI/View/onDrop(of:isTargeted:perform:))

Defines the destination of a drag-and-drop operation that handles the
dropped content with a closure that you specify.

[`onDrop(of:delegate:)`](/documentation/SwiftUI/View/onDrop(of:delegate:))

Defines the destination of a drag and drop operation using behavior
controlled by the delegate that you provide.

[`onDropSessionUpdated(_:)`](/documentation/SwiftUI/View/onDropSessionUpdated(_:))

Specifies an action to perform on each update of an ongoing drop operation
activated by `dropDestination(_:)` or other drop modifiers.

[`springLoadingBehavior(_:)`](/documentation/SwiftUI/View/springLoadingBehavior(_:))

Sets the spring loading behavior this view.

### Reordering

[`reorderContainer(for:isEnabled:move:)`](/documentation/SwiftUI/View/reorderContainer(for:isEnabled:move:))

Defines a container of reorderable views.

[`reorderContainer(for:in:isEnabled:move:)`](/documentation/SwiftUI/View/reorderContainer(for:in:isEnabled:move:))

Defines a container of reorderable views, with a type you specify to
identify sections.

[`reorderContainer(for:itemID:isEnabled:move:)`](/documentation/SwiftUI/View/reorderContainer(for:itemID:isEnabled:move:))

Defines a container of reorderable views, with a type and keypath you
specify to identify items.

[`reorderContainer(for:itemID:in:isEnabled:move:)`](/documentation/SwiftUI/View/reorderContainer(for:itemID:in:isEnabled:move:))

Defines a container of reorderable views, with a type and keypath you
use to identify items and a type you use to identify collections.

### Submission

[`onAssignedDocumentDidSubmit(_:)`](/documentation/SwiftUI/View/onAssignedDocumentDidSubmit(_:))

Adds an action to perform after submitting an assigned document.

[`onAssignedDocumentDidWithdraw(_:)`](/documentation/SwiftUI/View/onAssignedDocumentDidWithdraw(_:))

Adds an action to perform after an assigned document submission has been withdrawn.

[`onAssignedDocumentWillSubmit(_:)`](/documentation/SwiftUI/View/onAssignedDocumentWillSubmit(_:))

Adds an action to perform before submitting an assigned document.

[`onAssignedDocumentWillWithdraw(_:)`](/documentation/SwiftUI/View/onAssignedDocumentWillWithdraw(_:))

Adds an action to perform before withdrawing an assigned document submission.

[`onSubmit(of:_:)`](/documentation/SwiftUI/View/onSubmit(of:_:))

Adds an action to perform when the user submits a value to this view.

[`submitScope(_:)`](/documentation/SwiftUI/View/submitScope(_:))

Prevents submission triggers originating from this view to invoke
a submission action configured by a submission modifier higher up
in the view hierarchy.

[`submitLabel(_:)`](/documentation/SwiftUI/View/submitLabel(_:))

Sets the submit label for this view.

### Movement

[`onMoveCommand(perform:)`](/documentation/SwiftUI/View/onMoveCommand(perform:))

Adds an action to perform in response to a move command, like when the
user presses an arrow key on a Mac keyboard, or taps the edge of the
Siri Remote when controlling an Apple TV.

[`moveDisabled(_:)`](/documentation/SwiftUI/View/moveDisabled(_:))

Adds a condition for whether the view’s view hierarchy is movable.

### Deletion

[`onDeleteCommand(perform:)`](/documentation/SwiftUI/View/onDeleteCommand(perform:))

Adds an action to perform in response to the system’s Delete command,
or pressing either the ⌫ (backspace) or ⌦ (forward delete) keys while the view has focus.

[`deleteDisabled(_:)`](/documentation/SwiftUI/View/deleteDisabled(_:))

Adds a condition for whether the view’s view hierarchy is deletable.

### Commands

[`pageCommand(value:in:step:)`](/documentation/SwiftUI/View/pageCommand(value:in:step:))

Steps a value through a range in response to page up or page down
commands.

[`onExitCommand(perform:)`](/documentation/SwiftUI/View/onExitCommand(perform:))

Sets up an action that triggers in response to receiving the exit
command while the view has focus.

[`onPlayPauseCommand(perform:)`](/documentation/SwiftUI/View/onPlayPauseCommand(perform:))

Adds an action to perform in response to the system’s Play/Pause
command.

[`onCommand(_:perform:)`](/documentation/SwiftUI/View/onCommand(_:perform:))

Adds an action to perform in response to the given selector.

### Digital crown

[`digitalCrownAccessory(_:)`](/documentation/SwiftUI/View/digitalCrownAccessory(_:))

Specifies the visibility of Digital Crown accessory Views on Apple Watch.

[`digitalCrownAccessory(content:)`](/documentation/SwiftUI/View/digitalCrownAccessory(content:))

Places an accessory View next to the Digital Crown on Apple Watch.

[`digitalCrownRotation(_:from:through:sensitivity:isContinuous:isHapticFeedbackEnabled:onChange:onIdle:)`](/documentation/SwiftUI/View/digitalCrownRotation(_:from:through:sensitivity:isContinuous:isHapticFeedbackEnabled:onChange:onIdle:))

Tracks Digital Crown rotations by updating the specified binding.

[`digitalCrownRotation(_:onChange:onIdle:)`](/documentation/SwiftUI/View/digitalCrownRotation(_:onChange:onIdle:))

Tracks Digital Crown rotations by updating the specified binding.

[`digitalCrownRotation(detent:from:through:by:sensitivity:isContinuous:isHapticFeedbackEnabled:onChange:onIdle:)`](/documentation/SwiftUI/View/digitalCrownRotation(detent:from:through:by:sensitivity:isContinuous:isHapticFeedbackEnabled:onChange:onIdle:))

Tracks Digital Crown rotations by updating the specified binding.

[`digitalCrownRotation(_:)`](/documentation/SwiftUI/View/digitalCrownRotation(_:))

Tracks Digital Crown rotations by updating the specified binding.

[`digitalCrownRotation(_:from:through:by:sensitivity:isContinuous:isHapticFeedbackEnabled:)`](/documentation/SwiftUI/View/digitalCrownRotation(_:from:through:by:sensitivity:isContinuous:isHapticFeedbackEnabled:))

Tracks Digital Crown rotations by updating the specified binding.

### Game controller

[`handlesGameControllerEvents(matching:)`](/documentation/SwiftUI/View/handlesGameControllerEvents(matching:))

Specifies the game controllers events which should be delivered through
the GameController framework when the view, or one of its descendants
has focus.

[`handlesGameControllerEvents(matching:withOptions:)`](/documentation/SwiftUI/View/handlesGameControllerEvents(matching:withOptions:))

Specifies the game controllers events which should be delivered through
the GameController framework when the view or one of its descendants
has focus.

### Immersive spaces

For more information, see [Immersive spaces](/documentation/SwiftUI/Immersive-spaces)

Display unbounded content in a person’s surroundings..

[`onImmersionChange(initial:_:)`](/documentation/SwiftUI/View/onImmersionChange(initial:_:))

Performs an action when the immersion state of your app changes.

[`onWorldRecenter(action:)`](/documentation/SwiftUI/View/onWorldRecenter(action:))

Adds an action to perform when recentering the view with the
digital crown.

[`immersiveEnvironmentPicker(content:)`](/documentation/SwiftUI/View/immersiveEnvironmentPicker(content:))

Add menu items to open immersive spaces from a media player’s
environment picker.

### Volumes

[`onVolumeViewpointChange(updateStrategy:initial:_:)`](/documentation/SwiftUI/View/onVolumeViewpointChange(updateStrategy:initial:_:))

Adds an action to perform when the viewpoint of the volume changes.

[`supportedVolumeViewpoints(_:)`](/documentation/SwiftUI/View/supportedVolumeViewpoints(_:))

Specifies which viewpoints are supported for the window bar and
ornaments in a volume.

### User activities

[`userActivity(_:element:_:)`](/documentation/SwiftUI/View/userActivity(_:element:_:))

Advertises a user activity type.

[`userActivity(_:isActive:_:)`](/documentation/SwiftUI/View/userActivity(_:isActive:_:))

Advertises a user activity type.

[`onContinueUserActivity(_:perform:)`](/documentation/SwiftUI/View/onContinueUserActivity(_:perform:))

Registers a handler to invoke in response to a user activity that your
app receives.

[`handlesExternalEvents(preferring:allowing:)`](/documentation/SwiftUI/View/handlesExternalEvents(preferring:allowing:))

Specifies the external events that the view’s scene handles
if the scene is already open.

### View life cycle

[`onAppear(perform:)`](/documentation/SwiftUI/View/onAppear(perform:))

Adds an action to perform before this view appears.

[`onDisappear(perform:)`](/documentation/SwiftUI/View/onDisappear(perform:))

Adds an action to perform after this view disappears.

[`onChange(of:initial:_:)`](/documentation/SwiftUI/View/onChange(of:initial:_:))

Adds a modifier for this view that fires an action when a specific
value changes.

[`task(id:name:executorPreference:priority:file:line:_:)`](/documentation/SwiftUI/View/task(id:name:executorPreference:priority:file:line:_:))

Adds a task to perform before this view appears or when a specified
value changes.

[`task(id:name:priority:file:line:_:)`](/documentation/SwiftUI/View/task(id:name:priority:file:line:_:))

Adds a task to perform before this view appears or when a specified
value changes.

[`task(name:executorPreference:priority:file:line:action:)`](/documentation/SwiftUI/View/task(name:executorPreference:priority:file:line:action:))

Adds an asynchronous task to perform before this view appears.

[`task(name:priority:file:line:_:)`](/documentation/SwiftUI/View/task(name:priority:file:line:_:))

Adds an asynchronous task to perform before this view appears.

### File renaming

[`renameAction(_:)`](/documentation/SwiftUI/View/renameAction(_:))

Sets a closure to run for the rename action.

### URLs

[`onOpenURL(perform:)`](/documentation/SwiftUI/View/onOpenURL(perform:))

Registers a handler to invoke in response to a URL that your app
receives.

[`onOpenURL(prefersInApp:)`](/documentation/SwiftUI/View/onOpenURL(prefersInApp:))

Sets an `OpenURLAction` that prefers opening URL with an in-app browser.
The `handler` closure takes a URL as input, and returns a `OpenURLAction.Result` that
indicates the outcome of the action.

[`widgetURL(_:)`](/documentation/SwiftUI/View/widgetURL(_:))

Sets the URL to open in the containing app when the user clicks the widget.

### Asynchronous image loading

[`asyncImageURLSession(_:)`](/documentation/SwiftUI/View/asyncImageURLSession(_:))

A modifier that adds a URL session for asynchronous images contained in the view to use when fetching image data.

### Publisher events

[`onReceive(_:perform:)`](/documentation/SwiftUI/View/onReceive(_:perform:))

Adds an action to perform when this view detects data emitted by the
given publisher.

### Hit testing

[`allowsHitTesting(_:)`](/documentation/SwiftUI/View/allowsHitTesting(_:))

Configures whether this view participates in hit test operations.

### Content shape

[`contentShape(_:eoFill:)`](/documentation/SwiftUI/View/contentShape(_:eoFill:))

Defines the content shape for hit testing.

[`contentShape(_:_:eoFill:)`](/documentation/SwiftUI/View/contentShape(_:_:eoFill:))

Sets the content shape for this view.

### Import and export

[`exportsItemProviders(_:onExport:)`](/documentation/SwiftUI/View/exportsItemProviders(_:onExport:))

Exports a read-only item provider for consumption by shortcuts,
quick actions, and services.

[`exportsItemProviders(_:onExport:onEdit:)`](/documentation/SwiftUI/View/exportsItemProviders(_:onExport:onEdit:))

Exports a read-write item provider for consumption by shortcuts,
quick actions, and services.

[`importsItemProviders(_:onImport:)`](/documentation/SwiftUI/View/importsItemProviders(_:onImport:))

Enables importing item providers from services, such as Continuity Camera
on macOS.

[`exportableToServices(_:)`](/documentation/SwiftUI/View/exportableToServices(_:))

Exports items for consumption by shortcuts,
quick actions, and services.

[`exportableToServices(_:onEdit:)`](/documentation/SwiftUI/View/exportableToServices(_:onEdit:))

Exports read-write items for consumption by shortcuts,
quick actions, and services.

[`importableFromServices(for:action:)`](/documentation/SwiftUI/View/importableFromServices(for:action:))

Enables importing items from services, such as Continuity Camera
on macOS.

### App intents

[`appEntityIdentifier(_:)`](/documentation/SwiftUI/View/appEntityIdentifier(_:))

Associates a SwiftUI view with an app entity to make its content discoverable by Apple Intelligence and Siri.

[`appEntityIdentifier(forSelectionType:identifier:)`](/documentation/SwiftUI/View/appEntityIdentifier(forSelectionType:identifier:))

Associates the items in a SwiftUI list view with app entities to make them discoverable by Apple Intelligence and Siri.

[`appEntityUIElements(_:)`](/documentation/SwiftUI/View/appEntityUIElements(_:))

Provides the system with additional context to make a custom view’s content discoverable by Apple Intelligence and Siri.

[`onAppIntentExecution(_:perform:)`](/documentation/SwiftUI/View/onAppIntentExecution(_:perform:))

Registers a handler to invoke in response to the specified app intent that your
app receives.

[`shortcutsLinkStyle(_:)`](/documentation/SwiftUI/View/shortcutsLinkStyle(_:))

Sets the given style for ShortcutsLinks within the view hierarchy

[`siriTipViewStyle(_:)`](/documentation/SwiftUI/View/siriTipViewStyle(_:))

Sets the given style for SiriTipView within the view hierarchy

### Camera

[`onCameraCaptureEvent(isEnabled:action:)`](/documentation/SwiftUI/View/onCameraCaptureEvent(isEnabled:action:))

Used to register an action triggered by system capture events.

[`onCameraCaptureEvent(isEnabled:defaultSoundDisabled:action:)`](/documentation/SwiftUI/View/onCameraCaptureEvent(isEnabled:defaultSoundDisabled:action:))

Used to register an action triggered by system capture events.

[`onCameraCaptureEvent(isEnabled:defaultSoundDisabled:primaryAction:secondaryAction:)`](/documentation/SwiftUI/View/onCameraCaptureEvent(isEnabled:defaultSoundDisabled:primaryAction:secondaryAction:))

Used to register actions triggered by system capture events.

[`onCameraCaptureEvent(isEnabled:primaryAction:secondaryAction:)`](/documentation/SwiftUI/View/onCameraCaptureEvent(isEnabled:primaryAction:secondaryAction:))

Used to register actions triggered by system capture events.

[`cameraAnchor(isActive:)`](/documentation/SwiftUI/View/cameraAnchor(isActive:))

Specifies the view that should act as the virtual camera for Apple Vision Pro
2D Persona stream.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)