There is a code that, by pressing the "Sign Up" button at the bottom of the screen, should open another window. But for some reason, when you click on the button, no action occurs.
I need the View to switch when I click on the button.
import SwiftUI
import CoreData
struct LoginView: View {
@State private var email: String = "Email"
@State private var password: String = "Password"
@State private var showSignup: Bool = false
var body: some View {
ZStack {
VStack {
VStack(alignment: .leading) {
VStack {
LoginText
LoginForm
GradientButton(text: "Login")
.frame(maxWidth: .infinity, alignment: .leading)
ForgotPass(text: "Forgor Password")
.frame(maxWidth: .infinity, alignment: .leading)
}
}
.padding([.top, .horizontal], 40)
.frame(maxWidth: .infinity, alignment: .leading)
.offset(y: 104)
VStack {
Spacer()
Rectangle()
.frame(height: 1)
.foregroundColor(.secondary.opacity(0.4))
VStack {
Button( action: {
showSignup.toggle()
}, label: {
ForgotPass(text: "Sign Up")
})
}
}
}
.background(Color.white)
if showSignup {
SignupView()
}
}
}