When I apply the scrollview it pushes my whole view up and leaves a white space below the bottom of the ZStack. Not sure why but if someone can please help.
var body: some View {
ZStack{
GeometryReader { geometry in
Spacer()
ScrollView (.vertical, showsIndicators: false) {
VStack (spacing : self.Vspacing){
Spacer()
ForEach (self.buttons, id: \.self) { row in
SportsButtonsRow(screenWidth: geometry.size.width,
Hspacing: self.Hspacing,
buttons: row, didTapButton: { sportButton in self.displayText = sportButton.title}
)
}//end foreach
// Spacer ()
}.background(Color.black)//end of VStack
}//end of scroll view
}//close geometry reader
}//end of ZStack
.edgesIgnoringSafeArea(.all)
}//end of main some View
}

You need to change the order of containers construction. The following scratch demo works:
var body: some View {
ZStack{
GeometryReader { geometry in
ScrollView (.vertical, showsIndicators: false) {
// YOUR CONTENT HERE
}
.background(Color.black)//end of VStack
.frame(height: geometry.size.height)
//end of scroll view
} //close geometry reader
.edgesIgnoringSafeArea(.all)
} //end of ZStack
} //end of main some View
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With