Amit
Amit

Reputation: 645

iOS TextField Strong password autofill, even if we don't want it

I am using two textField password & confirmPassword

My iCloud Keychain is turned On.

  @State private var email: String = ""
    @State private var password: String = ""
    @State private var passwordConfirmation: String = ""
   
    var body: some View {
        ScrollView {
            VStack(spacing: 16) {
                TextField("Email address", text: $email)
                SecureField("Password", text: $password)
                    .textContentType(.password)
                SecureField("Password confirmation", text: $passwordConfirmation)
                    .textContentType(.password)
            }
            .padding(.vertical, 32)
            .padding(.horizontal, 16)
        }
    }

When I tap on the password secure field, iOS show me the strong password view :

enter image description here

If I use this feature, everything is working fine, but if I tap on "Other options..." then "Choose my own password":

enter image description here

The textfields are cleared (that's great), but if I tap on the email textfield (or any other textfields), the password secure field is filled with the strong password that I've just said I don't want...

Here is a video :

enter image description here

I tried couple of approaches like. first.contentType = .newPassword and second.contentType = .password or use .newPassword for both but does not works.

Bug reference: https://developer.apple.com/forums/thread/716589

Upvotes: 1

Views: 1323

Answers (1)

qwaswsa
qwaswsa

Reputation: 305

.textContentType(.none)

this will disable autofill

Upvotes: 0

Related Questions