Contents

presentationDetents(_:)

Sets the available detents for the enclosing sheet.

Declaration

nonisolated func presentationDetents(_ detents: Set<PresentationDetent>) -> some View

Parameters

  • detents:

    A set of supported detents for the sheet. If you provide more that one detent, people can drag the sheet to resize it.

Discussion

By default, sheets support the large detent.

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

    var body: some View {
        Button("View Settings") {
            showSettings = true
        }
        .sheet(isPresented: $showSettings) {
            SettingsView()
                .presentationDetents([.medium, .large])
        }
    }
}

See Also

Configuring a sheet’s height