Autofill multiply SecureFields issue in SwiftUI view

Hello forums,

I have a problem with Autofill multiply SecureFields. I created a SwiftUI view with 2 SecureFields, createPassword and confirmPassword. Does not matter how I change the textContentType, AutoFill will only fill the first SecureField.

For testing, I set the first SecureField textContentType to .none / .userName/ .email, and second SecureField sets to .newPassword, but AutoFill still fills password in first SecureField.

As I know Apple advises to put both SecureField textContentType to .newPassword but it seems only working in UIKit:

Enabling Password AutoFill on a text input view

struct ContentView: View {

    @State private var createPassword = ""
    @State private var confirmPassword = ""
    var body: some View {
        VStack {
            SecureField("Password", text: $createPassword)
                .textContentType(.newPassword)
            SecureField("Password confirmation", text: $confirmPassword)
                .textContentType(.newPassword)
        }
        .padding()
    }
}

Thank you!

Autofill multiply SecureFields issue in SwiftUI view
 
 
Q