I wanted to try out the new .presentationBackground modifier from iOS 16.4+ for a clear background in a Sheet. Stack Overflow posts like this suggest it's possible.
But the presentationBackground just seems to be overlaid over the default sheet background.
With this code:
import SwiftUI
struct ImmersionModeScreen: View {
@State var presentSheet: Bool = false
var body: some View {
VStack(alignment: .center, spacing: 15) {
Button {
presentSheet = true
} label: {
Text("Present")
}
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(.red)
.sheet(isPresented: $presentSheet) {
Text("Detail")
.presentationBackground(.clear)
}
}
}
#Preview {
ImmersionModeScreen()
}
I got this result:
The background of the sheet is not clear like we're telling it to be.
And when I use a shape for .presentationBackground:
.presentationBackground {
UnevenRoundedRectangle(
cornerRadii: RectangleCornerRadii(topLeading: 100, topTrailing: 100),
style: .continuous
)
.fill(.orange)
}
Once again, it's not working properly—you can still see the default background behind.
What am I doing wrong?
My project is running on iOS 18.


