-
Notifications
You must be signed in to change notification settings - Fork 132
Gladymir's Commit 1 Password Text Field #143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
private func setupShowHideButton() { | ||
showHideButton.setImage(UIImage(named: "eyes-closed.png"), for: .normal) | ||
|
||
addSubview(showHideButton) | ||
showHideButton.translatesAutoresizingMaskIntoConstraints = false | ||
showHideButton.isUserInteractionEnabled = false | ||
|
||
showHideButton.trailingAnchor.constraint(equalTo: textField.trailingAnchor, constant: -standardMargin).isActive = true | ||
showHideButton.centerYAnchor.constraint(equalTo: textField.centerYAnchor, constant: 0).isActive = true | ||
|
||
showHideButton.addTarget(self, action: #selector(showHideToggled), for: .touchUpInside) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your button isn't toggling, to give you a hint... It is one single line of code in this function right here.
func textFieldShouldReturn(_ textField: UITextField) -> Bool { | ||
textField.resignFirstResponder() | ||
return true | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You do not have your send action, so the password is not printing out because it is not being sent.
private func updatePasswordState(_ string: String) { | ||
if string.count < 10 { | ||
strengthDescriptionLabel.text = PasswordStrength.weak.rawValue | ||
weakView.backgroundColor = weakColor | ||
mediumView.backgroundColor = unusedColor | ||
strongView.backgroundColor = unusedColor | ||
// animateStrengthViews(weakView) | ||
if mediumView.backgroundColor == mediumColor || weakView.backgroundColor == unusedColor { | ||
animateStrengthViews(weakView) | ||
} | ||
} else if string.count < 20 { | ||
strengthDescriptionLabel.text = PasswordStrength.medium.rawValue | ||
weakView.backgroundColor = weakColor | ||
mediumView.backgroundColor = mediumColor | ||
strongView.backgroundColor = unusedColor | ||
// animateStrengthViews(mediumView) | ||
if strongView.backgroundColor == strongColor || mediumView.backgroundColor == unusedColor { | ||
animateStrengthViews(mediumView) | ||
} | ||
} else if string.count >= 20 { | ||
strengthDescriptionLabel.text = PasswordStrength.strong.rawValue | ||
weakView.backgroundColor = weakColor | ||
mediumView.backgroundColor = mediumColor | ||
strongView.backgroundColor = strongColor | ||
// animateStrengthViews(strongView) | ||
if strongView.backgroundColor == unusedColor { | ||
animateStrengthViews(strongView) | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way you currently have it set up, it is not doing the animation at all, I think you are trying to make it so it doesn't perform the animation on every single character you type. One way you could do that would be like this...
if string.count == 20 {
animateStrengthViews(strongView)
}
@maybemichael