I have a scroll view just like that.
public var body: some View {
ScrollView {
ZStack {
VStack(spacing: 0) {
BannerView
.frame(height: UIScreen.main.bounds.height * 0.30)
SignInContent
}
}
}
.ignoresSafeArea(.all)
}
Before adding the scrollview, everything was fine except the screen is not able to scroll. But after I put inside a scrollview. The white area appear. Spacer() can't help pushing from inside to bottom. Below screenshot, ZStack is highlighted which is inside the scrollview. I also find a way to change background color of scrollview but can't. The only solution i found yet is to add .padding(.bottom) to the lowest view of SignInContent but I don't think it's a proper way.

You have set the height of
BannerViewto 0.3 of the screen height. So I guessSignInContenthas the black background. But if the height ofSignInContentis not as much as 0.7 of the screen height then the background will run out.A
Spacerinside aScrollViewwill have no effect, so maybe this is why the height ofSignInContentis less than it was before theScrollViewwas put around it. Even settingframe(maxHeight: .infinity)will have no effect.To fix, you could move the background to the
ScrollView:Alternatively, you could set the minimum height of
SignInContentto the remainder of the screen height. Here, it would be better to use aGeometryReaderto read the height of the screen, instead of usingUIScreen.main.bounds, which is deprecated. However, if the height is increased after the background is applied, then the background won't grow. So you need to do it the other way around and apply the background after increasing the height:You wouldn't have to apply the background again if
SignInContentwas implemented as aZStackwith the background color as one of the layers: