Apple continues to evolve the design language of iOS with every release, and one of the most noticeable improvements is the new translucent glassy effect seen in system navigation bars. This effect uses a combination of blur, vibrancy, and adaptive translucency, giving apps a modern, layered feel.
In this article, we'll walk through how to implement a glassy, translucent navigation bar in SwiftUI. We'll also discuss best practices and how this approach improves user experience.
Starting Point β A Custom Toolbar
Here's a basic NavigationView toolbar implementation (your reference code):
.navigationTitle("")
.navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem(placement: .cancellationAction) {
Button(action: {
presentationMode.wrappedValue.dismiss()
}) {
Image("iconBack")
}
}
ToolbarItem(placement: .principal) {
Text("Payment Schedule")
.font(Font.responsiveSFComRegular(size: 18))
.foregroundColor(.primary)
}
ToolbarItem(placement: .confirmationAction) {
Button(action: {
// Share action
}) {
Image("iconShare")
}
}
}This gives us a functional navigation bar with custom icons and a centered title. But by default, it looks flat and doesn't apply the iOS translucent glassy effect.
Step 1 β Enabling Translucent Appearance
In iOS 15+, you can use UINavigationBarAppearance to customize the navigation bar globally. For the glassy look, we need to set the background to transparent while keeping a blur effect.
Add this inside your App or at the start of a View using init():
init() {
let appearance = UINavigationBarAppearance()
appearance.configureWithTransparentBackground()
// Apply blur effect
appearance.backgroundEffect = UIBlurEffect(style: .systemUltraThinMaterial)
// Customize title color & font if needed
appearance.titleTextAttributes = [
.foregroundColor: UIColor.label
]
// Apply appearance to navigation bar
UINavigationBar.appearance().standardAppearance = appearance
UINavigationBar.appearance().scrollEdgeAppearance = appearance
}Here:
.configureWithTransparentBackground()removes the solid background..backgroundEffectadds Apple's system blur materials (systemUltraThinMaterialis closest to the glass look).scrollEdgeAppearanceensures the effect works when you scroll large lists.
Step 2 β Integrating with SwiftUI Navigation Bar
Once configured, your existing toolbar code automatically adopts the translucent design. The result:
β Custom icons + text β Glassy blur background β Adaptive colors (light/dark mode)
Step 3 β Adding a Gradient Glass Layer (Optional)
If you want a more futuristic glass effect, you can overlay a gradient. For example:
appearance.backgroundColor = UIColor.clear.withAlphaComponent(0.3)
appearance.backgroundEffect = UIBlurEffect(style: .systemUltraThinMaterial)
let gradient = UIImage.gradientImage(
colors: [.systemPink.withAlphaComponent(0.3), .systemBlue.withAlphaComponent(0.3)],
size: CGSize(width: UIScreen.main.bounds.width, height: 44)
)
appearance.backgroundImage = gradientWith this, your navigation bar gets a neon glassy look β perfect for apps with a modern or cyberpunk theme.
(You'd need a simple UIImage.gradientImage extension to generate the gradient as a UIImage.)
Step 4 β Testing on Real Devices
Simulators often don't show blurring + vibrancy exactly as real iPhones do. Always test on device:
- On light mode, the navigation bar looks like frosted glass.
- On dark mode, it adapts to a smoky translucent effect.
- When scrolling, the bar smoothly blends with content.
Final Result
By combining SwiftUI's Toolbar API with UINavigationBarAppearance customizations, you get:
- A fully customizable toolbar (buttons, icons, centered titles).
- A system-consistent glassy navigation bar.
- A design that automatically adapts to dynamic type, dark mode, and accessibility settings.
About the Author
π¨βπ» Kirit Gareja π Mobile App Developer | iOS First, Design Always I craft polished, high-performance iOS apps using SwiftUI and UIKit, with a sharp eye for modern UI styles like Cyberpunk, Neumorphism, and Flat Design. My focus is on creating intuitive, visually rich interfaces powered by solid, maintainable code.
π§ garejakirit@gmail.com π LinkedIn