SwiftUI fun fact:
—Kyle Ye (@KyleSwifter) October 13, 2025
In case you didn't know, transition can affect the order of onAppear and onDisappear calls.
Hard to say whether this is an intended feature or a bug.
For identity transition, it will be "ADAD..."
For non-identity transition, it will be "AADA..." pic.twitter.com/FucCN9ocFr
Here's an interesting quirk I discovered while working on OpenSwiftUI: the type of transition you apply to a view can actually change the order in which onAppear and onDisappear callbacks fire.
The Behavior
When you attach lifecycle callbacks to a view with transitions, you might expect a consistent order of events. But it turns out the transition type matters:
Identity transition: Call order is "ADAD..." (Appear → Disappear → Appear → Disappear)
Non-identity transition: Call order is "AADA..." (Appear → Appear → Disappear → Appear)
This difference is subtle but can lead to unexpected behavior if you're relying on a specific callback sequence for state management or animations.
Why Does This Happen?
The root cause can be found in the OpenSwiftUI implementation. The transition system's internal handling of view lifecycle differs based on whether the transition is an identity (no-op) transition or an actual transition with animation effects.
I've written two unique CompatibilityTests cases to verify this behavior, confirming that this is consistent behavior between SwiftUI and OpenSwiftUI. Whether it's intentional or a quirk that's now part of the API contract is hard to say.