Skip to content

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Gladymir
Copy link

@Gladymir Gladymir commented Aug 2, 2020

Comment on lines 146 to 157
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)
}

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.

Comment on lines 286 to 290
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
textField.resignFirstResponder()
return true
}
}

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.

Comment on lines 163 to 192
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)
}
}
}

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)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants