Instance Method

transaction(_:)

Applies the given transaction mutation function to all transactions used within the view.

Declaration

func transaction(_ transform: @escaping (inout Transaction) -> Void) -> some View

Parameters

transform

The transformation to apply to transactions within this view.

Return Value

A view that wraps this view and applies transformation to all transactions used within the view.

Discussion

Use this modifier on leaf views rather than container views. The transformation applies to all child views within this view; calling transaction(_:) on a container view can lead to unbounded scope.

See Also

Handling View Taps and Gestures

func onTapGesture(count: Int, perform: () -> Void) -> View

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

func gesture<T>(T, including: GestureMask) -> View

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

func highPriorityGesture<T>(T, including: GestureMask) -> View

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

func simultaneousGesture<T>(T, including: GestureMask) -> View

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

func digitalCrownRotation<V>(Binding<V>) -> View

Tracks Digital Crown rotations by updating the specified binding.