Hide password with "•••••••" in a textField

Clément Bisaillon picture Clément Bisaillon · Sep 26, 2014 · Viewed 147.8k times · Source

In my app there is a textField where the user have to put is password in and i want that when he enter a character it change it to '•' how can i do this?

Answer

meda picture meda · Sep 26, 2014

You can achieve this directly in Xcode:

enter image description here

The very last checkbox, make sure secure is checked .

Or you can do it using code:

Identifies whether the text object should hide the text being entered.

Declaration

optional var secureTextEntry: Bool { get set }

Discussion

This property is set to false by default. Setting this property to true creates a password-style text object, which hides the text being entered.

example:

texfield.secureTextEntry = true