The save credentials prompt is not shown after clicking the submit button in the following setup. The prompt is shown if I move the email field before the login field.
Is it really required to have login and password fields at the end of the registration form? Or is there some API that can trigger the prompt?
struct FakeRegistrationView: View {
@State private var login = ""
@State private var password = ""
@State private var repeatPassword = ""
@State private var email = ""
var navigateBack: () -> Void
var body: some View {
VStack(spacing: 16) {
TextField("Login", text: $login)
.textFieldStyle(.roundedBorder)
.textContentType(.username)
.disableAutocorrection(true)
.autocapitalization(.none)
.frame(maxWidth: 300)
SecureField("Password", text: $password)
.textFieldStyle(.roundedBorder)
.textContentType(.newPassword)
.disableAutocorrection(true)
.autocapitalization(.none)
.frame(maxWidth: 300)
SecureField("Repeat password", text: $repeatPassword)
.textFieldStyle(.roundedBorder)
.textContentType(.newPassword)
.disableAutocorrection(true)
.autocapitalization(.none)
.frame(maxWidth: 300)
TextField("Email", text: $email)
.textFieldStyle(.roundedBorder)
.textContentType(.emailAddress)
.disableAutocorrection(true)
.autocapitalization(.none)
.frame(maxWidth: 300)
Button {
Task {
try? await Task.sleep(for: .seconds(2))
navigateBack()
}
} label: {
Text("Submit")
}
.buttonStyle(.borderedProminent)
}
}
}