How to create a password field in xcode
Update for Xcode 12.2+
My opinion is programmatic declaration of properties are easier to toggle back and forth.
Programmatically in Swift 5:
myPasswordTextField.isSecureTextEntry = true
Sounds like you are looking for "setSecureTextEntry
" on a "UITextField
" object.
Also known as the "secureTextEntry
" property in the "UITextInputTraits
" protocol.
You can call this programatically via calling ".secureTextEntry = YES
" on the "UITextField
" object you want to be set for passwords.
You can also set it in Interface Builder (look for "Secure" checkbox in your text field Attributes inspector). It looks like this:
And in newer version of Xcode: