<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/Transaction",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI11TransactionV"
  },
  "title" : "Transaction"
}
-->

# Transaction

The context of the current state-processing update.

```
@frozen struct Transaction
```

## 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(_:_:)`](/documentation/SwiftUI/withTransaction(_:_:)) or
[`withAnimation(_:_:)`](/documentation/SwiftUI/withAnimation(_:_:)).

## Topics

### Creating a transaction

[`init()`](/documentation/SwiftUI/Transaction/init())

Creates a transaction.

[`init(animation:)`](/documentation/SwiftUI/Transaction/init(animation:))

Creates a transaction and assigns its animation property.

### Managing animations

[`animation`](/documentation/SwiftUI/Transaction/animation)

The animation, if any, associated with the current state change.

[`disablesAnimations`](/documentation/SwiftUI/Transaction/disablesAnimations)

A Boolean value that indicates whether views should disable animations.

[`addAnimationCompletion(criteria:_:)`](/documentation/SwiftUI/Transaction/addAnimationCompletion(criteria:_:))

Adds a completion to run when the animations created with this
transaction are all complete.

### Managing window dismissal

[`dismissBehavior`](/documentation/SwiftUI/Transaction/dismissBehavior)

The behavior for how windows will dismiss programmatically when used in
conjunction with [`DismissWindowAction`](/documentation/SwiftUI/DismissWindowAction).

### Getting information about a transaction

[`isContinuous`](/documentation/SwiftUI/Transaction/isContinuous)

A Boolean value that indicates whether the transaction originated from
an action that produces a sequence of values.

[`scrollTargetAnchor`](/documentation/SwiftUI/Transaction/scrollTargetAnchor)

The preferred alignment of the view within a scroll view’s visible
region when scrolling to a view.

[`tracksVelocity`](/documentation/SwiftUI/Transaction/tracksVelocity)

Whether this transaction will track the velocity of any animatable
properties that change.

[`subscript(_:)`](/documentation/SwiftUI/Transaction/subscript(_:))

Accesses the transaction value associated with a custom key.



---

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)