Transactions occur when a Binding has changed and an animation must take place.
I’m starting here with a RectangleView that takes a Color. This is used to set the foregroundColor of a Rectangle, and there’s an explicit Animation.linear. In the absence of any modifications to the Transaction, this linear animation would fade from one colour to the next in less than a second, without changing the animation speed.
That’s exactly what’s happening in ContentView. The tap gesture causes the colour to change from blue to red, or from red to blue if it’s already red. Before that happens, a Transaction is created with a different kind of animation. There’s a Boolean value called animationEnabled, and a Toggle labelled Ease In changes this value.
This determines if the linear animation inside RectangleView is used, because it determines if the Transaction has the power to override animations in subviews that it affects.
Try running the app and tapping the Rectangle.
The animation will change based on the state of the Toggle, because the Transaction will either override the animation or let it play depending on whether transaction.disablesAnimation is true or not.



