Transaction
The context of the current state-processing update.
Declaration
type Transaction =
| { animation: Animation | null; }
| { animation?: Animation | null; disablesAnimations?: boolean; dismissBehavior?: DismissBehavior; isContinuous?: boolean; scrollContentOffsetAdjustmentBehavior?: ScrollContentOffsetAdjustmentBehavior; scrollPositionUpdatePreservesVelocity?: boolean; scrollTargetAnchor?: UnitPoint | null; tracksVelocity?: boolean; }
| TransactionChain;@frozen struct TransactionType 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.
- EnvironmentValuesReadableKeys of SwiftUI EnvironmentValues JavaScript can read.
- EnvironmentValuesWritableKeys of SwiftUI EnvironmentValues JavaScript can write.
- TransactionChainTransaction with chained calls: SwiftUI.Transaction.addAnimationCompletion(...).
- TransactionReadableKeys of SwiftUI Transaction JavaScript can read.
- TransactionWritableKeys of SwiftUI Transaction JavaScript can write.