0

I have a Text view. Once this Text is pressed I need to navigate to another view of my application. I tried with the NavigationView and NavigationLink but I'm not able to perform the navigation.

HStack(alignment: .bottom, spacing: 0) {
  Text("Already member? ")
    .foregroundColor(.gray)
                
  Text("Login now")
    .foregroundColor(.blue)
    .underline()
    .onTapGesture {
      // TODO: Navigate to LoginView()
    }
}
.frame(minWidth: 0, maxWidth: .infinity, alignment: .center)
.padding(.top, 40)

This is my tappable Text. I don't know if the problem with the NavigationView depends on the multiple text that I have in my hstack.

What I need

carlo97
  • 169
  • 1
  • 3
  • 12
  • Use `$isActive` from `NavigationLink`. – Neck Apr 27 '22 at 18:39
  • The problem is that I need just a classic navigation without back button and also the navigation title. From the login view I need to go to the registration view and from the registration view I need to go to the login view. – carlo97 Apr 27 '22 at 20:09
  • 1
    `NavigationView { ///HStack... NavigationLink(destination: LoginView().navigationBarHidden(true), isActive: $isActive) {EmptyView()} }` Set isActive==true on tap of LoginNow text. – Neck Apr 27 '22 at 20:20
  • Ok it works. There is a way to have a transition right to left in the case of going to the LoginView and left to right if I want come back? – carlo97 Apr 27 '22 at 20:48

0 Answers0