I am coding useing swiftUI and I have a vertical scrollView
(see screenshots), and inside that scrollView
I have another horizontal scrollView
, and below that I have a VStack
that I want the height to fill the rest of the screen to the bottom of the vertical scrollView
, but I can't seem to make it work.
The content in the vertical scrollView
can be larger than the actually remaining space in some cases that is why I need a scrollView, but in some other cases the content is smaller than the remaining space
Here is the code I have :
VStack {
HeaderView
ScrollView(.vertical, showsIndicators: false) {
FriendsHorizontalScrollView()
VStack {
// I want this view to take all the remaining height left in the scrollView
FullHeightView()
}
.frame(width: UIScreen.main.bounds.width)
}
}
What I end up having is something like this :
What I want to have :
I have tried several solutions like using geometryReader or putting .frame(maxHeight: .infinity)
on the VStack
but nothing seems to work properly.