Transaction

The context of the current state-processing update.

StructureiOS 13.0+macOS 10.15+tvOS 13.0+watchOS 6.0+Transaction in SwiftUI

Declaration

React
type Transaction =
  | { animation: Animation | null; }
  | { animation?: Animation | null; disablesAnimations?: boolean; dismissBehavior?: DismissBehavior; isContinuous?: boolean; scrollContentOffsetAdjustmentBehavior?: ScrollContentOffsetAdjustmentBehavior; scrollPositionUpdatePreservesVelocity?: boolean; scrollTargetAnchor?: UnitPoint | null; tracksVelocity?: boolean; }
  | TransactionChain;
Swift
@frozen struct Transaction

Type methods

Overview

Use a transaction to pass an animation between views in a view hierarchy.

The root transaction for a state change comes from the binding that changed, plus any global values set by calling withTransaction(_:_:) or withAnimation(_:_:).

From Apple’s SwiftUI documentation. Code samples there are Swift.

Used by

See also

More in State and environment.