Answers for "swift enable button when text is entered"

0

xcode enable a button after a text field is filled

@objc func editingChanged(_ textField: UITextField) {
    if textField.text?.characters.count == 1 {
        if textField.text?.characters.first == " " {
            textField.text = ""
            return
        }
    }
    guard
        let habit = habitNameField.text, !habit.isEmpty,
        let goal = goalField.text, !goal.isEmpty,
        let frequency = frequencyField.text, !frequency.isEmpty
    else {
        doneBarButton.isEnabled = false
        return
    }
    doneBarButton.isEnabled = true
}
Posted by: Guest on September-01-2020

Code answers related to "swift enable button when text is entered"

Code answers related to "Swift"

Browse Popular Code Answers by Language