Skip to content

zaimramlan/ios-secure-code-entry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Secure Code Entry

IDE Platform Language License

An iOS app that imitates Apple's passcode entry to showcase the a single digit UITextField custom class; SecureCodeTextField.

demo

Features

  1. Only allow a single digit per textfield
  2. Disables UITextField action menu commands to prevent copy/paste
  3. Cursor auto moves to previous/next textfield after a single character text entry
  4. Works with arbitrary amount of textfields on screen

Usages

  1. Copy and paste SecureCodeTextField.swift into your project
  2. Set the custom class of the UITextFields on your storyboard file to SecureCodeTextField
  3. Point the current SecureCodeTextField's previousTextField and nextTextField to the respective text fields. For example:
    let firstTF = SecureCodeTextField()
    let secondTF = SecureCodeTextField()
    let thirdTF = SecureCodeTextField()
    
    secondTF.previousTextField = firstTF
    secondTF.nextTextField = thirdTF
  4. Your textfields should now jump to previous/next textfields as desired!

More Examples?

Look into the ViewController.swift file and you should be able to understand in the scenario where we have 4 SecureCodeTextFieldss