1
 Button(action: { signIn() }){ Text("Sign In") .font(.title) .frame(minWidth: 0, maxWidth: 200) .cornerRadius(100.00) .frame(height: 20) .padding() .foregroundColor(.white) .font(.system(size: 14, weight: .bold)) .background(Color.blue) .cornerRadius(5.0) }.alert(isPresented: $showingAlert) { Alert(title: Text(alertTitle), message: Text(error), dismissButton: .default(Text("Ok!"))) } 

THE SIGN IN FUNCTION BEING CALLED BELOW! This func and whatnot I think signs me in (I see in my firebase log) but it doesn't transfer me to the next screen. I tried a navlink but it lets you press sign in then go to Home Screen no matter what.

func signIn() {

 if let error = errorCheck() { self.error = error self.showingAlert = true return } AuthService.signIn(email: email, password: password, onSuccess: { (user) in self.clear() }) { (errorMessage) in print("Error \(errorMessage)") self.error = errorMessage self.showingAlert = true return } } 
1
  • I think what you want is a fullScreenCover. So add a new State variable and add .fullScreenCover(isPresented: $navigate) { YourView()} and in the button where you wanna navigate to the next screen add navigate.toggle(). Let me know if this is what you want Commented Aug 7, 2021 at 7:34

1 Answer 1

1

add this to your view to activate the next screen;

@State var activate = false 

and add this to your view, for example after the button:

NavigationLink("", destination: Text("the next screen"), isActive: $activate) 

then add this to your func signIn() just after self.clear() to change the activate state.

activate = true 

assuming func signIn() is also in your view.

Note your view must have NavigationView for NavigationLink to work.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.