SwiftUI 4 introduced custom-sized sheets via `presentationDetents`, but sheets always dim the underlying view — even at small sizes — making Apple Maps-style interactions impossible. This post presents a workaround using `UIViewControllerRepresentable` and a custom `UndimmedDetentViewController` to access `UISheetPresentationController`'s `largestUndimmedDetentIdentifier` property from SwiftUI. A bridging enum `PresentationDetentReference` maps between SwiftUI and UIKit detent types, and a custom `PresentationDetentsViewModifier` ties it all together with an API that mirrors the native SwiftUI modifier. The solution is available in the SwiftUIKit open source library.
Table of contents
BackgroundUndimming the underlying view in UIKitUndimming the underlying view in SwiftUIBridging UIKit and SwiftUIControlling SwiftUI undimming with UIKitUndimming the underlying view in SwiftUIConclusion7 Impressions