One Logo Pool Ball
SwiftUICore · IOS API REFERENCE

ContentTransition

struct · iOS 16.0+ · SDK 27.1

struct ContentTransition

A kind of transition that applies to the content within a single view, rather than to the insertion or removal of a view. Set the behavior of content transitions within a view with the ``View/contentTransition(_:)`` modifier, passing in one of the defined transitions, such as ``opacity`` or ``interpolate`` as the parameter. > Tip: Content transitions only take effect within transactions that apply an ``Animation`` to the views inside the ``View/contentTransition(_:)`` modifier. Content transitions only take effect within the context of an ``Animation`` block.

Members (6)

get · iOS 16.0+

interpolate

TypeScript
static get interpolate(): ContentTransition
Swift declaration
static let interpolate: ContentTransition

A content transition that indicates the views attempt to interpolate their contents during transitions, where appropriate. Text views can interpolate transitions when the text views have identical strings. Matching glyph pairs can animate changes to their color, position, size, and any variable properties. Interpolation can apply within a ``Font/Design`` case, but not between cases, or between entirely different fonts. For example, you can interpolate a change between ``Font/Weight/thin`` and ``Font/Weight/black`` variations of a font, since these are both cases of ``Font/Weight``. However, you can't interpolate between the default design of a font and its Italic version, because these are different fonts. Any changes that can't show an interpolated animation use an opacity animation instead. Symbol images created with the ``Image/init(systemName:)`` initializer work the same way as text: changes within the same symbol attempt to interpolate the symbol's paths. When interpolation is unavailable, the system uses an opacity transition instead.

static · iOS 16.0+

numericText

TypeScript
static numericTextCountsDown(countsDown?: boolean): ContentTransition
Swift declaration
static func numericText(countsDown: Bool = false) -> ContentTransition

Creates a content transition intended to be used with `Text` views displaying numeric text. In certain environments changes to the text will enable a nonstandard transition tailored to numeric characters that count up or down. - Parameters: - countsDown: true if the numbers represented by the text are counting downwards. - Returns: a new content transition.

static · iOS 17.0+

numericText

TypeScript
static numericTextValue(value: number): ContentTransition
Swift declaration
static func numericText(value: Double) -> ContentTransition

Creates a content transition intended to be used with `Text` views displaying numbers. The example below creates a text view displaying a particular value, assigning the same value to the associated transition: Text("\(value)") .contentTransition(.numericText(value: value)) - Parameters: - value: the value represented by the `Text` view being animated. The difference between the old and new values when the text changes will be used to determine the animation direction. - Returns: a new content transition.

get · iOS 17.0+

symbolEffect

TypeScript
static get symbolEffect(): ContentTransition
Swift declaration
@export(implementation) static var symbolEffect: ContentTransition { get }

A content 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.

get · iOS 16.0+

opacity

TypeScript
static get opacity(): ContentTransition
Swift declaration
static let opacity: ContentTransition

A content transition that indicates content fades from transparent to opaque on insertion, and from opaque to transparent on removal.

get · iOS 16.0+

identity

TypeScript
static get identity(): ContentTransition
Swift declaration
static let identity: ContentTransition

The identity content transition, which indicates that content changes shouldn't animate. You can pass this value to a ``View/contentTransition(_:)`` modifier to selectively disable animations that would otherwise be applied by a ``withAnimation(_:_:)`` block.

Skipped declarations

1 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

ContentTransition.symbolEffect(_:options:)

This declaration needs Swift generic type arguments. (no canonical witness for T)

All SwiftUICore types →