I have a login page that depending who logs in, it goes directly to either a InventoryView or ChartView.
Before, whenever the login button was pressed it would go through an if statement and then call a function to determine who logged in. Then it would change either the userLogin or adminLog to True and then NavigationLink would be able to pick up if one of the variables was active or not and then go to their respective view.
This changed with iOS 16, NavigationLink(destination:, Action:) is deprecated. Any ideas how to do this now?
Button ("Login") {
print("Button presed")
if dataManager.loginCheck(email: email, password: password) >= 1 {
dataManager.userLogin = true
} else if dataManager.loginCheck(email: email, password: password) == 0 {
dataManager.adminLogin = true
} else {
print("Wrong Login Info")
}
}
.foregroundColor(.white)
.frame(width: 300, height: 50)
.background(Color.blue)
.cornerRadius(10)
.offset(y: 0)
NavigationLink(destination: InventoryView(dataManager: DataManager()), isActive: $dataManager.userLogin) {
}
NavigationLink(destination: ChartView(dataManager: DataManager()), isActive: $dataManager.adminLogin) {
}