Specify colors for digits and letters in password

This commit is contained in:
Bob Sun 2017-10-07 22:16:59 -07:00
parent f3551a1542
commit 6ea47766bc
2 changed files with 4 additions and 2 deletions

View file

@ -107,9 +107,9 @@ public class Utils {
for (index, element) in plainPassword.unicodeScalars.enumerated() {
var charColor = UIColor.darkText
if NSCharacterSet.decimalDigits.contains(element) {
charColor = Globals.red
charColor = Globals.digitColor
} else if !NSCharacterSet.letters.contains(element) {
charColor = Globals.blue
charColor = Globals.letterColor
}
attributedPassword.addAttribute(NSAttributedStringKey.foregroundColor, value: charColor, range: NSRange(location: index, length: 1))
}