Contents

presentationBreakthroughEffect(_:)

Changes the way the enclosing presentation breaks through content occluding it.

Declaration

nonisolated func presentationBreakthroughEffect(_ effect: BreakthroughEffect) -> some View

Parameters

  • effect:

    The type of effect to apply when a presentation element is occluded by other content.

Discussion

Use this modifier to disable or customize a breakthrough effect for the enclosing presentation.

Breakthrough is an effect allowing elements to be visible to the user even when other app content (3D models, UI elements) is occluding it. The way the element appears depends on the chosen BreakthroughEffect.

Most system presentations appear with a breakthrough effect by default. For these cases, you can customize the type of effect by applying the presentationBreakthroughEffect(_:) modifier to the content of the presentation, like in the following example:

Button("Show Details") {
    isShowingDetails = true
}
.popover(isPresented: $isShowingDetails) {
    DetailsView()
        .presentationBreakthroughEffect(.prominent)
}

Only popovers allow breakthrough to be disabled altogether. Passing a .none value for a sheet has no effect.