Question about .presentationDetents and interactiveDismissDisabled modifiers

I have an app that I'm working on where I'd like to use the .presentationDetents modifier and I need the view to not be dismissed by the user. I'm therefore using the .interactiveDismissDisabled modifier. Unfortunately, that means that the Map on the ContentView can no longer respond to touch gestures. How can I have a similar experience to the Maps app where the underlying Map (or other views) can be interacted with and the user can still be prevented from dismissing the view controlled by the .presentationDetents modifier?

SomeView(searchResults: $searchResults, selectedItem: $selectedItem) .presentationDetents([.height(100), .medium]) .presentationDragIndicator(.visible) .interactiveDismissDisabled(true)

Answered by Frameworks Engineer in 810793022

The presentationbackgroundinteraction modifier should provide the functionality you're looking for.

https://developer.apple.com/documentation/swiftui/view/presentationbackgroundinteraction(_:)

You may need to implement a sheet by yourself. I found a third-party package BottomSheet which might be what you want.


WindowsMEMZ @ Darock Studio
let myEmail = "memz" + "1" + "@" + "darock.top"

Accepted Answer

The presentationbackgroundinteraction modifier should provide the functionality you're looking for.

https://developer.apple.com/documentation/swiftui/view/presentationbackgroundinteraction(_:)

Question about .presentationDetents and interactiveDismissDisabled modifiers
 
 
Q