Skip to content
An easy to use `UITextField` subclass that adds a visibility toggle and an optional validation checkmark
Swift Ruby
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Example/HideShowPasswordTextFieldExample Update for Swift 5 and fix bugs from iOS 12 SDK Jun 26, 2019
HideShowPasswordTextField Need to load images from the bundle Jul 2, 2019
.gitignore Initial commit May 2, 2016
HideShowPasswordTextField.podspec update to support xcode 10 + swift 4 Jan 23, 2019
LICENSE Initial commit May 2, 2016
README.md Update README.md Jun 26, 2019

README.md

HideShowPasswordTextField

An easy to use UITextField subclass that adds a visibility toggle and an optional validation checkmark

Created by @lookatpete (product), @pklada (design), and @miketsprague (code)

gif

Installation

Cocoapods

pod 'HideShowPasswordTextField', :git => 'https://github.com/Guidebook/HideShowPasswordTextField'

Manual

Just add the files in HideShowPasswordTextField/ to your project.

Usage

  • Create a UITextField in your xib, and change the class name to HideShowPasswordTextField. Or, create it programatically.
  • Set secureTextEntry to true, if you want the password to hide by default.
  • [Recommended] Change the border style to None, and add a height constraint of 44 or larger. The assets in this project are optimized for 44px, although larger is fine too. Smaller sizes might have clipping issues on the icons.
  • Implement UITextFieldDelegate and forward textField shouldChangeCharactersInRange and textFieldDidEndEditing to your password text field (see the example). We have to do this to get the behavior to work right--apple's API doesn't play very nice switching between secureTextEntry states.
    • This step is no longer necessary.
  • [Optional] Implement HideShowPasswordTextFieldDelegate to show the validation checkbox.
  • Customize the textField to your liking (the tint too!)!
You can’t perform that action at this time.