Logo for tanaschita.com

When SwiftUI automatically applies the glass look and when it doesn’t

Understanding where SwiftUI decides to use the new glass styles automatically.

13 Oct 2025 · 3 min read

Since iOS 18, buttons, toolbars, and other controls can appear in Apple's new glass button style. What's interesting is that SwiftUI sometimes applies this effect automatically, depending on where a view is placed. In this article, we'll look at when that happens, when it doesn't.

Sponsorship logo
Architecture & Design Patterns for iOS
This book is a practical guide to essential architectural principles and design patterns for iOS development. It covers strategies for building maintainable apps with Swift and SwiftUI, including dependency injection, navigation, common patterns, and modularization.
LEARN MORE

Automatic glass style in toolbars

The most visible case of automatic glass styling happens in toolbars. When we use system placements like .confirmationAction, .cancellationAction, or .automatic, SwiftUI automatically applies the new .glass style to buttons placed there.

.toolbar {
ToolbarItem(placement: .confirmationAction) {
Button("Save", action: save)
}
ToolbarItem(placement: .cancellationAction) {
Button("Cancel", action: cancel)
}
}

Even though we never set .buttonStyle(.glass), both buttons adopt the glass appearance.

At the moment, there’s no official way to opt out. Applying .buttonStyle(.plain) or changing the layout does not remove the glass styling.

When glass doesn't appear in toolbars

The only remaining place in toolbars where the automatic glass style does not apply is the .principal placement. This slot is meant for titles or custom content and keeps its regular appearance, even if it contains buttons:

.toolbar {
ToolbarItem(placement: .principal) {
HStack {
Text("Title Text")
Image(systemName: "leaf")
Button("Action", action: {})
}
}
}

Buttons outside toolbars

Outside toolbars, buttons do not get the glass style automatically. A standard Button in a normal view does not adopt any automatic glass styling, we have to apply it ourselves if we want the look:

VStack(spacing: 20) {
Button("Add", action: add)
Button("Glass Add", action: add)
.buttonStyle(.glass)
}
Sponsorship logo
Preparing for a technical iOS job interview
Preparing for a technical iOS Job Interview with over 300 questions & answers. Covering Swift & Objective-C, SwiftUI & UIKit, Combine, HTTP Networking, iOS File System, Core Data, Concurrency with async/await, Security, Automated Testing, Dependency Management, AI & Machine Learning and more.
LEARN MORE
Sponsorship logo
Architecture & Design Patterns for iOS
This book is a practical guide to essential architectural principles and design patterns for iOS development. It covers strategies for building maintainable apps with Swift and SwiftUI, including dependency injection, navigation, common patterns, and modularization.
LEARN MORE
Sponsorship logo
Become a sponsor of tanaschita.com
By publishing an article on different iOS topics every week, tanaschita.com is constantly growing in the developer community and may provide a great audience for you as a sponsor.
CLICK TO LEARN MORE

Newsletter

Image of a reading marmot
Subscribe

Like to support my work?

Say hi

Related tags

Articles with related topics

swiftui

swift

concurrency

async/await

ios

Building responsive and reliable search in SwiftUI

Learn how to debounce search input, cancel obsolete requests and prevent stale results using Swift concurrency.

14 Sep 2026 · 6 min read

Latest articles and tips

© 2026 tanaschita.com

Privacy policy

Impressum