SwiftUI not changing views when button pressed.

Hello. I am trying to make a signup/login page, but I can't fix this problem. I am very new to Swift, and everything online says what I am doing is right, but it won't work. I have 2 files, ContentView, Login and SignUp. When I do this SignUp(), or Login() it doesn't change views and stays the same. This is what I have tried on ContentView()

Text("Hello! Welcome.")
Button("I'm new") {
    SignUp()
}
Button("I'm returning") {
    Login()
}

It also gives a warning saying "Result of 'SignUp' initializer is unused" on both files. Does anyone know how I can make it so that when the button is pressed it actually changes views? Thanks!

You cannot call for a view in the button action.

But you can change a State var.

Here is an example of what you could do:

struct SignUp: View {
    
    var body: some View {
        Text("Please, sign.")
    }
}

struct Login: View {
    
    var body: some View {
        Text("Please, Login.")
    }
}

struct ContentView83: View {

    @State var signUp = false
    @State var logIn = false

    var body: some View {
        Text("Hello! Welcome.")
        Spacer()
        Button("I'm new") {
            signUp = true
            logIn = false
        }
        Spacer()
        Button("I'm returning") {
            logIn = true
            signUp = false
        }
        
        if signUp {
            Spacer()
            SignUp()
        }
        
        if logIn {
            Spacer()
            Login()
        }
    }
}
SwiftUI not changing views when button pressed.
 
 
Q