<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/Transition",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI10TransitionP"
  },
  "title" : "Transition"
}
-->

# Transition

A description of view changes to apply when a view is added to and removed
from the view hierarchy.

```
@MainActor @preconcurrency protocol Transition
```

## Overview

A transition should generally be made by applying one or more modifiers to
the `content`. For symmetric transitions, the `isIdentity` property on
`phase` can be used to change the properties of modifiers. For asymmetric
transitions, the phase itself can be used to change those properties.
Transitions should not use any identity-affecting changes like `.id`, `if`,
and `switch` on the `content`, since doing so would reset the state of the
view they’re applied to, causing wasted work and potentially surprising
behavior when it appears and disappears.

The following code defines a transition that can be used to change the
opacity and rotation when a view appears and disappears.

```
struct RotatingFadeTransition: Transition {
    func body(content: Content, phase: TransitionPhase) -> some View {
        content
          .opacity(phase.isIdentity ? 1.0 : 0.0)
          .rotationEffect(phase.rotation)
    }
}
extension TransitionPhase {
    fileprivate var rotation: Angle {
        switch self {
        case .willAppear: return .degrees(30)
        case .identity: return .zero
        case .didDisappear: return .degrees(-30)
        }
    }
}
```

A type conforming to this protocol inherits `@preconcurrency @MainActor`
isolation from the protocol if the conformance is included in the type’s
base declaration:

```
struct MyCustomType: Transition {
    // `@preconcurrency @MainActor` isolation by default
}
```

Isolation to the main actor is the default, but it’s not required. Declare
the conformance in an extension to opt out of main actor isolation:

```
extension MyCustomType: Transition {
    // `nonisolated` by default
}
```

- See Also: `TransitionPhase`
- See Also: `AnyTransition`

## Topics

### Getting built-in transitions

[`blurReplace`](/documentation/SwiftUI/Transition/blurReplace)

A transition that animates the insertion or removal of a view
by combining blurring and scaling effects.

[`blurReplace(_:)`](/documentation/SwiftUI/Transition/blurReplace(_:))

A transition that animates the insertion or removal of a view
by combining blurring and scaling effects.

[`identity`](/documentation/SwiftUI/Transition/identity)

A transition that returns the input view, unmodified, as the output
view.

[`move(edge:)`](/documentation/SwiftUI/Transition/move(edge:))

Returns a transition that moves the view away, towards the specified
edge of the view.

[`offset(_:)`](/documentation/SwiftUI/Transition/offset(_:))

Returns a transition that offset the view by the specified amount.

[`offset(x:y:)`](/documentation/SwiftUI/Transition/offset(x:y:))

Returns a transition that offset the view by the specified x and y
values.

[`opacity`](/documentation/SwiftUI/Transition/opacity)

A transition from transparent to opaque on insertion, and from opaque to
transparent on removal.

[`push(from:)`](/documentation/SwiftUI/Transition/push(from:))

Creates a transition that when added to a view will animate the
view’s insertion by moving it in from the specified edge while
fading it in, and animate its removal by moving it out towards
the opposite edge and fading it out.

[`scale`](/documentation/SwiftUI/Transition/scale)

Returns a transition that scales the view.

[`scale(_:anchor:)`](/documentation/SwiftUI/Transition/scale(_:anchor:))

Returns a transition that scales the view by the specified amount.

[`slide`](/documentation/SwiftUI/Transition/slide)

A transition that inserts by moving in from the leading edge, and
removes by moving out towards the trailing edge.

[`symbolEffect`](/documentation/SwiftUI/Transition/symbolEffect)

A transition that applies the default symbol effect transition
to symbol images within the inserted or removed view hierarchy.
Other views are unaffected by this transition.

[`symbolEffect(_:options:)`](/documentation/SwiftUI/Transition/symbolEffect(_:options:))

Creates a transition that applies the provided effect to symbol
images within the inserted or removed view hierarchy. Other
views are unaffected by this transition.

### Configuring a transition

[`animation(_:)`](/documentation/SwiftUI/Transition/animation(_:))

Attaches an animation to this transition.

[`properties`](/documentation/SwiftUI/Transition/properties)

Returns the properties this transition type has.

### Using a transition

[`apply(content:phase:)`](/documentation/SwiftUI/Transition/apply(content:phase:))

[`combined(with:)`](/documentation/SwiftUI/Transition/combined(with:))

### Creating a custom transition

[`body(content:phase:)`](/documentation/SwiftUI/Transition/body(content:phase:))

Gets the current body of the caller.

[`Body`](/documentation/SwiftUI/Transition/Body)

The type of view representing the body.

[`Transition.Content`](/documentation/SwiftUI/Transition/Content)

The content view type passed to `body()`.

### Supporting types

[`BlurReplaceTransition`](/documentation/SwiftUI/BlurReplaceTransition)

A transition that animates the insertion or removal of a view by
combining blurring and scaling effects.

[`IdentityTransition`](/documentation/SwiftUI/IdentityTransition)

A transition that returns the input view, unmodified, as the output
view.

[`MoveTransition`](/documentation/SwiftUI/MoveTransition)

Returns a transition that moves the view away, towards the specified
edge of the view.

[`OffsetTransition`](/documentation/SwiftUI/OffsetTransition)

Returns a transition that offset the view by the specified amount.

[`OpacityTransition`](/documentation/SwiftUI/OpacityTransition)

A transition from transparent to opaque on insertion, and from opaque to
transparent on removal.

[`PushTransition`](/documentation/SwiftUI/PushTransition)

A transition that when added to a view will animate the view’s insertion by
moving it in from the specified edge while fading it in, and animate its
removal by moving it out towards the opposite edge and fading it out.

[`ScaleTransition`](/documentation/SwiftUI/ScaleTransition)

Returns a transition that scales the view.

[`SlideTransition`](/documentation/SwiftUI/SlideTransition)

A transition that inserts by moving in from the leading edge, and
removes by moving out towards the trailing edge.



---

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)