I'm making SwiftUI package to display custom Sheet at quarter, half and full screen. I achieved the partial sheet and make It draggable. The problem is when Sheet contains scrollable content like List or ScrollView.
For exemple for usage without scrollable content like this :
ZStack {
Color.blue
YLFlexSheet(sheetMode: $sheetMode, draggable: true){
Color.black
}
}
It works like that :

With scrollable content in sheet :
ZStack {
Color.blue
YLFlexSheet(sheetMode: $sheetMode, draggable: true){
List{
Text("Hello")
}
}
}

YLFlexSheet
public struct YLFlexSheet<Content: View>: View {
@State private var dragOffset = CGSize.zero
private let content: () -> Content
private let draggable: Bool
@Binding private var sheetMode: YLSheetMode
public init(sheetMode: Binding<YLSheetMode>,
draggable: Bool = false,
@ViewBuilder content: @escaping () -> Content) {
self.content = content
self._sheetMode = sheetMode
self.draggable = draggable
}
public var body: some View {
Group {
if draggable {
content()
.onTapGesture { }
.gesture(
DragGesture(minimumDistance: 30, coordinateSpace: .local)
.onChanged { value in
dragOffset = value.translation
}
.onEnded{ value in
dragOffset = .zero
updateMode(translationHeight: value.translation.height)
}
)
}else{
content()
}
}
.cornerRadius(20)
.offset(y: offSet > 0 ? offSet : 0)
.animation(.spring())
.edgesIgnoringSafeArea(.all)
}
}
I'm looking for way of keeping the content scrollable if needed. Do you have an idea how to manage both scrollable content and the DragGesture of the sheet.
Like this :

I try some thing like minimumDistance
on DragGesture, onTap
and highPriorityGesture
without success.