I want to have a login form on my app that is using SwiftUI. I have two buttons: a log in and a sign up. I want to be able to press the sign up button and have the new SwiftUI view that I made appear/replace the other one. Here is my code for my button:
let signupButton = Color(red: 103.0/255.0, green: 104.0/255.0, blue: 255.0/255.0)
let text : String
var body: some View {
Button(action: {
}) {
Text(text)
.accentColor(.white)
// .frame(minWidth: 0, maxWidth: 300)
.frame(width: 200)
.padding()
.background(signupButton)
.cornerRadius(10)
.padding()
}
}
}
And then for my login page:
struct LoginPage: View {
let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String
let textFieldBackground = Color(red: 240.0/255.0, green: 240.0/255.0, blue: 240.0/255.0)
let textFieldBorder = Color(red: 112.0/255.0, green: 112.0/255.0, blue: 112.0/255.0)
let signupButton = Color(red: 103.0/255.0, green: 104.0/255.0, blue: 255.0/255.0)
var body: some View {
NavigationView {
Text("Don't have an account?")
.fontWeight(.light)
NavigationLink(destination: SignupPage()) {
ActionButton(text: "sign up")
}
}
.navigationBarTitle(Text("Signin")
.foregroundColor(Color.black))
}
}
}
The issue is, when I press the button, the signup page is not shown. I have an already designed page named SignupPage() and the reference is right. I don't know if this is a bug, or if I'm just doing this all wrong
ActionButtonview and also unbalanced brackets.