@IBAction func eyeButtonPressed(_ sender: Any) { if passwordTextField.isSecureTextEntry == false { passwordTextField.isSecureTextEntry = true eyeImageView.image = UIImage(systemName: "eye.slash") } else { passwordTextField.isSecureTextEntry = false eyeImageView.image = UIImage(systemName: "eye") } eyeImageView.setImageColor(color: UIColor.gray) }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter