I would like to have a VStack with a single view with fixed height on top, and the rest of the VStack taken up by a ScrollView. The code I am using right now to test this out is shown below. That works just fine when I use 3 Text views and the ScrollView, the 3 Text views show on top, with the ScrollView taking up the rest of the space:
But when I remove one of the 3 text views, the ScrollView fills the whole screen, covering the Text views:
How do I make it work with one view on top?
struct ContentView: View {
var body: some View {
return VStack {
Text("First Text")
.background(Color(red:0.5, green:0, blue:0))
Text("Second")
Text("Third")
ScrollView {
VStack(spacing:0) {
Text("Hello")
Text("World")
}
}
.frame(maxWidth:.infinity)
// .edgesIgnoringSafeArea(.all)
.background(Color(red:0, green:0.5, blue:0))
}
.edgesIgnoringSafeArea(.all)
.frame(maxWidth:.infinity, maxHeight:.infinity)
}
}


