glassEffectID

Associates an identity value to glass effects defined within this view.

View ModifieriOS 26.0+macOS 26.0+tvOS 26.0+watchOS 26.0+glassEffectID(_:in:) in SwiftUI

Declaration

React
compose().glassEffectID(
  id: (string | number | boolean) | null,
  options: {
    in: string;
  }
)
Swift
nonisolated func glassEffectID(
    _ id: (some Hashable & Sendable)?,
    in namespace: Namespace.ID
) -> some View

Parameters

  • id*(string | number | boolean) | null
  • options.in*string

Discussion

You use this modifier with the View.glassEffect(_:in:) view modifier and GlassEffectContainer view. When used together, SwiftUI will use the provided identifier to animate shapes to and from each other during transitions.

See also

More in Visual effects.