.blur(radius:) modifier on any view, apply iOS 15+ system materials like .background(.ultraThinMaterial), or wrap UIVisualEffectView with UIViewRepresentable for custom UIKit blur effects.Why this happens
SwiftUI didn’t ship with a dedicated background-blur API until iOS 15 introduced system materials. Before that, developers either blurred the entire view with .blur() — which also blurs foreground content — or dropped down to UIVisualEffectView via UIViewRepresentable. Today you have three practical paths depending on your deployment target and design needs.
How to fix it
1. Native .blur() modifier (iOS 13+)
Apply .blur(radius:) directly to the view you want blurred. This is simplest when the blurred content is a single image, color, or grouped view hierarchy.
Image("background")
.blur(radius: 20)
// .blur(radius: 20, opaque: true) removes the translucent edges
Tip: Wrap multiple views in a Group or container before blurring so they blur together as one layer.
2. System materials (iOS 15+)
Use the built-in material backgrounds for a live, vibrancy-aware blur that automatically adapts to light/dark mode and accessibility settings.
ZStack {
// Your background content
Image("background")
.resizable()
.ignoresSafeArea()
// Frosted overlay
Rectangle()
.fill(.ultraThinMaterial) // or .thinMaterial, .regularMaterial, .thickMaterial, .chromeMaterial
.ignoresSafeArea()
}
Materials work on any view via .background(.ultraThinMaterial) or .background(.regularMaterial, in: RoundedRectangle(cornerRadius: 12)) for shaped containers.
3. UIVisualEffectView via UIViewRepresentable (iOS 13+)
When you need a specific UIBlurEffect.Style (.systemUltraThinMaterialDark, .systemChromeMaterial, etc.) or want exact UIKit parity, wrap the visual effect view.
import SwiftUI
import UIKit
struct BlurView: UIViewRepresentable {
let style: UIBlurEffect.Style
func makeUIView(context: Context) -> UIVisualEffectView {
UIVisualEffectView(effect: UIBlurEffect(style: style))
}
func updateUIView(_ uiView: UIVisualEffectView, context: Context) {
uiView.effect = UIBlurEffect(style: style)
}
}
Usage:
ZStack {
List(1...100) { _ in
Rectangle().fill(Color.pink)
}
BlurView(style: .systemMaterial)
.frame(width: 300, height: 300)
.cornerRadius(16)
Text("Content on top of blur")
.font(.headline)
.foregroundColor(.primary)
}
How to prevent it
- Prefer system materials (
.ultraThinMaterialetc.) on iOS 15+ — they respect Reduce Transparency and Dark Mode automatically. - Avoid applying
.blur()to large view hierarchies; it rasterizes the entire subtree and can hurt scrolling performance. - When using
UIViewRepresentable, cache theUIVisualEffectViewinmakeUIViewand only update theeffectinupdateUIViewto avoid recreating the blur layer. - Test with Reduce Transparency enabled (Settings → Accessibility → Display & Text Size) to ensure content remains legible.
FAQ
Can I blur only part of a view, like a bottom sheet background?
Yes. Apply a material background to the sheet’s container view: .background(.regularMaterial, in: RoundedRectangle(cornerRadius: 20, style: .continuous)). The blur stays confined to that shape.
Does .blur() affect touch handling or child views?
No. .blur() is a rendering effect only; hit-testing and child interactivity remain unchanged. However, the blurred layer is rasterized, so animations inside it may appear less smooth.
Which approach uses the least memory on older devices?
System materials are optimized by the compositor. Custom UIVisualEffectView wrappers add a tiny overhead for the UIViewRepresentable bridge. Avoid large .blur(radius:) radii on full-screen images — they create large intermediate textures.
Parts of this guide are adapted from content licensed under CC BY-SA 4.0; this article is shared under the same license.
