presentationPlacement

Sets the placement of a presentation within the presenting view.

View ModifieriOS 27.0+macOS 27.0+tvOS 27.0+watchOS 27.0+visionOS 27.0+presentationPlacement(_:) in SwiftUI

Declaration

React
compose().presentationPlacement(
  placement: SwiftUI.PresentationPlacement
)
Swift
nonisolated func presentationPlacement(
    _ placement: PresentationPlacement
) -> some View

Parameters

Discussion

By default, a presentation uses PresentationPlacement.automatic placement. Use this modifier to place it on the leading or trailing edge. For example, to maximize the visibility of the primary content behind a presented sheet:

Map()
    .sheet(isPresented: $isPresented) {
        PlaceDetailView()
            .presentationDetents([.medium, .large])
            .presentationPlacement(.leading)
    }

Only sheet presentations respect this placement.

See also

More in Presentation.