Use VariableBlurView to create a progressive blur effect (variable blur) over your content. You can control the intensity via maxBlurRadius and the direction of the blur using the direction parameter.
Common directions include standard top-to-bottom blurs and upside-down blurs (clear at the top, blurred at the bottom) using .blurredTopClearBottom.
// Example: Creating a top-aligned progressive blur
ZStack(alignment: .top) {
Color.white
Color.blue.opacity(0.3)
Image("im")
.resizable()
.aspectRatio(contentMode: .fit)
.padding(.horizontal, 50)
Text("VariableBlur")
.font(.largeTitle.monospaced().weight(.bold))
.padding(.top, 230)
.foregroundStyle(.white.opacity(0.9))
}
.overlay(alignment: .top) {
VariableBlurView(maxBlurRadius: 20, direction: .blurredTopClearBottom)
.frame(height: 200)
}
.ignoresSafeArea()