Changing a Swift ViewController using a conditional statement

Viewed 33

I'm making a View to sign into an app I'm Making and I need help on switching views

Heres what I got so far:

import SwiftUI

struct VerifyView: View {
    @State private var PasswordToCheck = ""
    @AppStorage("CorrectPassword") private var CorrectPassword = "1234"
    var body: some View {
        VStack {
        Text("Password:")
        SecureField("Password", text: $PasswordToCheck)
       
            if PasswordToCheck == CorrectPassword {
                ContentView()
            
            }
            
        }
    }
}

But when I run it, it shows the VerifyView on top of ContentView

0 Answers
Related