VisualEffect
Visual Effects change the visual appearance of a view without changing its ancestors or descendents.
Declaration
type VisualEffect = SwiftOpaque<'VisualEffect'>;protocol VisualEffect : Sendable, AnimatableOverview
Because effects do not impact layout, they are safe to use in situations where layout modification is not allowed. For example, effects may be applied as a function of position, accessed through a geometry proxy:
var body: some View {
ContentRow()
.visualEffect { content, geometryProxy in
content.offset(x: geometryProxy.frame(in: .global).origin.y)
}
}You don't conform to this protocol yourself. Instead, visual effects are
created by calling modifier functions (such as .offset(x:y:) on other
effects, as seen in the example above.
From Apple’s SwiftUI documentation. Code samples there are Swift.
See also
More in Visual effects.