Enabling Password AutoFill on a Text Input View

Make sure a text input view displays the correct AutoFill suggestions.


To ensure your text input view displays the right AutoFill suggestions, set the textContentType property on any relevant input views.

Use the following UITextContentType values:


UITextContentType Value

User Name




New Password


One-Time Code


Explicitly defining a view’s text content type improves the performance of Password AutoFill’s heuristics and lets you support login workflows that couldn’t otherwise be detected by these heuristics. For example, the heuristics assume the user name and password inputs are on the same page. If you have a multipage login form, explicitly setting the .username and .password types lets the user tap and fill those inputs, even if they are on separate pages.

By default, the system selects the a keyboard based on the input view’s textContentType property; however, you can mix the input view’s text content type and keyboard type to explicitly define the desired keyboard. For example, if your site uses email addresses as user names, set the input view’s textContentType property to .UITextContentTypeUsername, and set the keyboardType property to .UIKeyboardTypeEmailAddress.

This example defines text fields for logging in:

userTextField.textContentType = .username
userTextField.keyboardType = .emailAddress
passwordTextField.textContentType = .password

When creating a new account or changing the password, use the .UITextContentTypeNewPassword text content type instead:

newPasswordTextField.textContentType = .newPassword
confirmPasswordTextField.textContentType = .newPassword

Additionally, you can autocomplete security codes from single-factor SMS login flows:

singleFactorCodeTextField.textContentType = .oneTimeCode

iOS supports Password AutoFill on UITextField, UITextView, and any custom view that adopts the UITextInput protocol.

For more information on how to enable Password AutoFill behavior in web apps, see Enabling Password AutoFill on an HTML Input Element.

See Also

Text Input Views


The semantic meaning expected by a text input area.


The expectation that a text input area specifies an account or login name.


The expectation that a text input area specifies a password.


The expectation that a text input area specifies a new password.


The expectation that a text input area specifies a one-time code that is frequently delivered over SMS.