How do I make a SwiftUI macOS App background blurred and transparent?

129 Views Asked by At

There are many apps which show a blurred background with the below windows' colors showing through. Here's an example:

enter image description here

How could I recreate this in SwiftUI 2.0 with a SwiftUI App Life-cycle? I know in a UIKit Life-cycle you can modify the window's to have a translucent background then blur it with a UIBlurEffect, but I'm not sure how to get this with a SwiftUI App Life-cycle, all of my google searches gave me UIKit Life-cycle examples.

I did try using .windowStyle(), but there was no option to get rid of the background, just the background of the title bar.

Here's what I have so far:

@main
struct MyAmazingBackgroundlessApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
                .frame(minWidth: 100, maxWidth: 10000, minHeight: 100, maxHeight: 10000)
        }.windowStyle(HiddenTitleBarWindowStyle())
    }
}
0

There are 0 best solutions below