I currently have a UITextfield with an eye icon in it that when pressed is supposed to toggle the secure text entry on and off.
UITextfield
I know you can che
@objc func togglePasscode(){ switch textfield.isSecureTextEntry{ case true: textfield.isSecureTextEntry = false case false: textfield.isSecureTextEntry = true } }
Here is a easy and more readable solution using Switch statement.