I'm trying to change the appearance of my UIButton when the user has filled in both UITextFields, but I'm unable to get past a while loop. Here's my code:
override func viewDidLoad() {
super.viewDidLoad()
FirstNameTextField.becomeFirstResponder()
FirstNameTextField.setBottomBorder()
LastNameTextField.setBottomBorder()
SignUpAndAccept.layer.cornerRadius = 10
SignUpAndAccept.clipsToBounds = true
SignUpAndAccept.isEnabled = false
self.navigationController?.navigationBar.isHidden = true
test()
}
func test(){
repeat {
if ((LastNameTextField.text?.isEmpty ?? true) && (FirstNameTextField.text?.isEmpty ?? true)){
SignUpAndAccept.backgroundColor = UIColor.gray
SignUpAndAccept.isEnabled = false
}
else if((LastNameTextField.text?.isEmpty ?? false) && (FirstNameTextField.text?.isEmpty ?? false)) {
SignUpAndAccept.backgroundColor = UIColor.purple
SignUpAndAccept.isEnabled = true
}
}while (SignUpAndAccept.isEnabled == false)
}