I am trying to navigate to a new SwiftUI file that I called HomePageView (Currently just consist of a red background and a text that says Home page.) The code below I tried to integrate with my Button which is 1 of 3 buttons on my initial view which is the ContentView. There are no errors but when I run my code my Login button, it shows the "Login Tapped!" text, but does not take me to the HomePageView. Am I using NavigationLink incorrectly? I know the next problem I will run into is with multiple buttons on one page leading to different destinations, any easy way to solve this, I am trying the tag method?
Note: There is other code in the some View text that are just images and textfields, as well as the two other buttons
@State private var current: Int? = nil
var body: some View {
NavigationLink(destination: HomePageView(), tag: 1, selection: self.$current) {
EmptyView()
}
Button(action: {
self.current = 1
print("Login tapped!")
}) {
Text("Login")
.fontWeight(.bold)
.foregroundColor(.orange)
.frame(width: deviceSize.size.width*(275/375), height: deviceSize.size.height*(45/812))
.cornerRadius(50)
.overlay(
Capsule(style: .continuous)
.stroke(Color.orange, style: StrokeStyle(lineWidth: 2)))
.frame(width: deviceSize.size.width, alignment: .center)
}.offset(y: deviceSize.size.height*(560/812))
}