Hello,
I'd like to know if and how I can include a completion handler to a navigationLink. Given the following:
struct SignupNavLink: View {
var body: some View {
NavigationLink(destination: HomeView()) { // Only trasition after the account has been created
Text("Signup")
.font(.headline)
.frame(minWidth: 0, maxWidth: .infinity)
.padding()
.background(Color.gray)
.foregroundColor(.black)
}
}
}
Before having the NavigationLink calling on HomeView() I would like to call the following function which would create a user account.
func registerNewUser() {
let privateKeyA = Curve25519.Signing.PrivateKey()
let publicKeyA = privateKeyA.publicKey.rawRepresentation.base64EncodedString()
print(publicKeyA)
let user = User()
user.password = "******"
user.name = "Test"
user.setProperty(propertyName: "userKey", propertyValue: publicKeyA)
Backendless.shared.userService.registerUser(user: user, responseHandler: { registeredUser in
print("User registration completed")
}, errorHandler: { fault in
print("Error: \(fault.message ?? "")")
})
}