Contents

presentationBackground(_:)

Sets the presentation background of the enclosing sheet using a shape style.

Declaration

nonisolated func presentationBackground<S>(_ style: S) -> some View where S : ShapeStyle

Parameters

  • style:

    The shape style to use as the presentation background.

Discussion

The following example uses the thick material as the sheet background:

struct ContentView: View {
    @State private var showSettings = false

    var body: some View {
        Button("View Settings") {
            showSettings = true
        }
        .sheet(isPresented: $showSettings) {
            SettingsView()
                .presentationBackground(.thickMaterial)
        }
    }
}

The presentationBackground(_:) modifier differs from the background(_:ignoresSafeAreaEdges:) modifier in several key ways. A presentation background:

  • Automatically fills the entire presentation.

  • Allows views behind the presentation to show through translucent styles on supported platforms.

See Also

Styling a sheet and its background