Apple純正のマップアプリのようなボトムシートを作成しようと試みて、調べたところ.sheetを使用しているサンプルがヒットしました。
Apple純正のマップアプリのようなボトムシートは出来たのですが、ボトムシートの裏にある要素が薄暗くなります。どのサンプルを見ても裏にある要素が薄暗くなってしまっていたのですが、解決している人を見たので備忘録として残します。
普通の.sheetとの比較
まず、どのような事象が出ているかをチェックします。
![]() | ![]() |
|---|---|
| 適用前 | 適用後 |
追加するコード
import SwiftUI
import MapKit
struct ContentView: View {
var body: some View {
Map()
.sheet(isPresented: .constant(true)){
Text("Sheet")
.presentationDetents([.height(100), .medium, .large])
+ .presentationBackgroundInteraction(.enabled)
}
}
}
#Preview {
ContentView()
}
https://developer.apple.com/documentation/swiftui/view/presentationbackgroundinteraction(_:)
presentationBackgroundInteraction(_:) | Apple Developer Documentation
Controls whether people can interact with the view behind a presentation.

出典
@ビスターさん
Thank you🙇🙇🙇

