The above says it all- I have a UITextField set to secure, but want to give users the option to make it not secure (so they can see for sure what they typed if they are in a pri
Swift version of Sandy's solution.
if #available(iOS 9.2, *) {
passwordTextField.secureTextEntry = !passwordTextField.secureTextEntry
}
else {
let wasFirstResponder = passwordTextField.isFirstResponder()
if wasFirstResponder {
passwordTextField.resignFirstResponder()
}
passwordTextField.secureTextEntry = !passwordTextField.secureTextEntry
if wasFirstResponder {
passwordTextField.becomeFirstResponder()
}
}