I have a ScrollView
inside my NavigationView
and for some reason my View has some white space on the top and i can't remove it
My code:
struct SignUpView: View {
@State var username: String = ""
@State var email: String = ""
@State var password: String = ""
@State var confrim_password = ""
var body: some View {
NavigationView {
ScrollView {
VStack {
Image("logo_transparent").resizable().scaledToFit()
.frame(width: 200, height: 200, alignment: .top)
Text("Sign up")
.bold()
.font(.system(size: 40))
TextField("Usename", text: $username)
.frame(height: 45)
.textFieldStyle(PlainTextFieldStyle())
.padding([.horizontal], 4)
.cornerRadius(16)
.overlay(RoundedRectangle(cornerRadius: 16).stroke(Color.gray))
.padding([.horizontal], 24)
TextField("Email", text: $email)
.frame(height: 45)
.textFieldStyle(PlainTextFieldStyle())
.padding([.horizontal], 4)
.cornerRadius(16)
.overlay(RoundedRectangle(cornerRadius: 16).stroke(Color.gray))
.padding([.horizontal], 24)
.padding(.top, 13)
SecureField("Password", text: $password)
.frame(height: 45)
.textFieldStyle(PlainTextFieldStyle())
.padding([.horizontal], 4)
.cornerRadius(16)
.overlay(RoundedRectangle(cornerRadius: 16).stroke(Color.gray))
.padding([.horizontal], 24)
.padding(.top, 13)
SecureField("Confirm Password", text: $confrim_password)
.frame(height: 45)
.textFieldStyle(PlainTextFieldStyle())
.padding([.horizontal], 4)
.cornerRadius(16)
.overlay(RoundedRectangle(cornerRadius: 16).stroke(Color.gray))
.padding([.horizontal], 24)
.padding(.top, 13)
.padding(.bottom, 25)
Text("Sign up")
.bold()
.font(.system(size: 25))
.foregroundColor(.white)
.padding()
.frame(width: 220, height: 50)
.background(Color.blue)
.cornerRadius(40)
NavigationLink(destination:
LoginView().navigationBarHidden(true)) {
Text("Already have an account? Sing in")
.bold()
.font(.system(size: 20))
.padding(.bottom, 300)
}
.padding(.top, 20)
}
}
}
}
}
struct SignUpView_Previews: PreviewProvider {
static var previews: some View {
SignUpView()
}
}