I am presenting a sheet in my app and setting presentation detent values to medium and large. The sheet also shows slider handle.
I want to sheet to expand to large/full size and minimize it to medium height, but I never want to close the sheet when dragged down further. Right now, if I drag the bottom panel/sheet when it's medium height, then the bottom panel closes. How I set minimum height or avoid closing the bottom panel like Apple Maps?
Code:
import SwiftUI
import Foundation
struct ContentView: View {
@State var showSheet = false
var body: some View {
VStack {
Button("Show sheet") {
showSheet = true
}
}
.sheet(isPresented: $showSheet) {
SheetView().presentationDetents([.medium, .large])
}
}
}
struct SheetView: View {
@State var largerSheet = false
var body: some View {
VStack {
Text("Hello World")
Text("Testing detents on bottom sheet.")
}
.padding()
}
}