Ventura and Xcode 15.2. Published: May 19th 2025
Getting Vibrancy is easy with SwiftUI, sidebars, inspectors and sheets automatically use vibrancy. For other situations, simply apply a
to the background of a view and SwiftUI handles the rest.
SwiftUI uses "thickness" as it's
options, instead of semantic naming (sidebar, sheet, etc). .
has the most pronounced effect.
While it was easy to make a panel vibrant in SwiftUI, I had this pit of the stomach feeling that it wasn't matching AppKit apps. So I made a comparison. SwiftUI on the right and the AppKit
on the left.
The
is allowing more blending of what's behind the window, while the native SwiftUI seems to use just a hint of the desktop picture. When compared like this, it doesn't even look like the right hand side has any vibrancy.
But... Adding a
, doesn't make the controls vibrant, only the background.
The code to use AppKit's
in SwiftUI is below.
The solution was to use both, SwiftUI's vibrancy on an enclosing
and a
to match AppKit made apps.
Honestly as I was preparing to write up a bug report, I came to the conclusion that it might be intentional. No other Apple platform is windowed quite like the macOS, so the SwiftUI vibrancy is meant to use the content of the application or window (but it is different to setting the blending mode of a NSVisualEffectView to window content blending). If Apple had made the blending match AppKit on the Mac it would be inconsistent with iOS, watchOS, tvOS, iPadOS etc.
However I do think Apple should have made some Materials just for the macOS that match AppKit. Apple Feedback case: FB17381328.
AppKit offers 4 different colors that you can use for labels and custom elements, SwiftUI Colors, only contain 2 .
and .
.
The other two colors are not colors, they're styles instead.
Site managed by Strawberry Software's Lifeboat - running on DigitalOcean's platform.
Pages
Products Contact Weblog SwiftUI PromosCompany
About Us Environment Privacy Terms Update PlansConnect
Bluesky Facebook Threads X / Twitter Mailing List