NEW: Check out my incredible new SpriteKit book! >>

How to hide passwords in a UITextField

Written by Paul Hudson    @twostraws

User text in a UITextField is visible by default, but you can enable the iOS text-hiding password functionality just by setting your text field's isSecureTextEntry property to be true, like this:

textField.isSecureTextEntry = true

Available from iOS 2.0

Did this solution work for you? Please pass it on!

Other people are reading…

About the Swift Knowledge Base

This is part of the Swift Knowledge Base, a free, searchable collection of solutions for common iOS questions.

Take Swift further!

Your Swift skills let you make apps for macOS, watchOS, tvOS, and more, and for one low price you can learn it all with my Swift Platform Pack!

Click here to visit the Hacking with Swift store >>