XcodesOrg / xcodes

The best command-line tool to install and switch between multiple versions of Xcode.
MIT License
3.84k stars 133 forks source link

he I am making an app with Xcode's but I saw that NavigationLink has changed in iOS 16 pleas help me #222

Closed ziyaxservers closed 2 years ago

ziyaxservers commented 2 years ago

struct ContentView: View { @State private var username = ""; @State private var password = ""; @State private var wrongUsername = 0; @State private var wrongPassword = 0; @State private var showingLoginScreen = false;

var body: some View {
    VStack {
        Image(systemName: ":Global:")
            .imageScale(.large)
            .foregroundColor(.accentColor);
        NavigationView {
            ZStack {
                Color.pink
                    .ignoresSafeArea();
                Circle()
                    .scale(1.7)
                    .foregroundColor(.white.opacity(0.15));
                Circle()
                    .scale(1.35)
                    .foregroundColor(.white);

                VStack {
                    Text("Login")
                        .font(.largeTitle)
                        .bold()
                        .padding()
                    TextField("Username",text: $username)
                        .padding()
                        .frame(width: 300, height: 50)
                        .background(Color.black.opacity(0.05))
                        .cornerRadius(10)
                        .border(.red, width: CGFloat(wrongUsername))

                    SecureField("Password",text: $password)
                        .padding()
                        .frame(width: 300, height: 50)
                        .background(Color.black.opacity(0.05))
                        .cornerRadius(10)
                        .border(.red, width: CGFloat(wrongPassword))

                    Button("Login") {
                        // Authenticate user
                    }
                    .foregroundColor(.white)
                    .frame(width: 300, height: 50)
                    .cornerRadius(10)

                    NavigationLink(destination: Text ("You are logged in @\(username)"), isActive: $showingLoginScreen) {
                        EmptyView()
                    }
                }
            }
            .navigationBarHidden(true)
            .padding();
        }
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

}

MattKiazyk commented 2 years ago

hi @Ziya121207 this is not the forum to ask about SwiftUI questions.