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)
The presentationbackgroundinteraction
modifier should provide the functionality you're looking for.
https://developer.apple.com/documentation/swiftui/view/presentationbackgroundinteraction(_:)