Hi. Ill paste my code below. The original post was more like a discussion question that is why I did not post any code.
Currently I set it to a fixed height
@State private var showFilter = false
var body: some View {
VStack {
Button {
showFilter.toggle()
} label : {
Text("show me")
}
}
.sheet(isPresented: $showFilter) {
VStack {
Text("Filter options")
.padding([.bottom], 20)
.presentationDetents([.height(500)])
ForEach(["All", "2.5+", "3.0+", "4.0+", "5.0+", "6.0+", "7.0+", "8.0+", "9.0+"], id: \.self) { filter in
Button {
showFilter.toggle()
} label: {
Text(filter)
}
.padding([.top, .bottom], 8)
}
}
}
}
The list may be long but I could decide to just remove 5,6,7,8,9 or vice versa that I wish to have the sheet height set based on the contents.
I will also check your suggestion.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: