Im trying to make my login button a navigation link to take me to the next view, but I think Im calling my function wrong. My code is below. Im trying to link the page WarehouseView to a successful login, for now just showing text WarehouseView. Ive declared all my @State variables, and my login button worked just fine before I added the navigation link. Im getting a "expected expression" message on the last two .self lines. Thank you.
NavigationView{
NavigationLink(destination: Text("WarehouseView"), isActive: $isshowingWarehouseView){}
Button(action:{ if self.username == storedusername && self.password == storedpassword { self.authenticationdidsucceed = true;
self.authenticationdidfail = false;, self.isshowingWarehouseView = true
} else {self.authenticationdidfail = true} }){
LoginButton()
It seems you have an extra comma here:
self.authenticationdidfail = false;, self.isshowingWarehouseView = true
Replace with:
self.authenticationdidfail = false; self.isshowingWarehouseView = true
Note: names should be camelCase, as authenticationDidFail for better readability.