How do I make text appear on the topLeading toolbar without it showing the glass button effect in SwiftUI?

Asked on 06/11/2025

1 search

To make text appear on the topLeading toolbar in SwiftUI without showing the glass button effect, you can use the backgroundVisibility modifier to separate the item into its own group without a background. This approach is mentioned in the session "Build a SwiftUI app with the new design" where it discusses how to manage toolbar items and their visual effects.

Here's a brief explanation based on the session:

  • Background Visibility Modifier: Apply the backgroundVisibility modifier to your toolbar item to ensure it doesn't inherit the glass effect, which can make it look like a button. This modifier allows you to separate an item into its own group without a background, thus avoiding the glass effect.

For more detailed guidance, you can refer to the session Build a SwiftUI app with the new design (08:46) where it discusses toolbars and their customization.