   func textFieldShouldReturn(_ textField: UITextField) -> Bool {
     textField.resignFirstResponder()
     return false
+  }
+
+  func textFieldShouldClear(_ textField: UITextField) -> Bool {
+    for controller in allTextFieldControllers {
+      if textField == controller.textInput {
+        controller.setErrorText(nil, errorAccessibilityValue: nil)
+        return true
+      }
+    }
+    return true
+  }
+
+  func textField(_ textField: UITextField,
+                 shouldChangeCharactersIn range: NSRange,
+                 replacementString string: String) -> Bool {
+    for controller in allTextFieldControllers {
+      if textField == controller.textInput {
+        let finishedString = (textField.text as NSString?)?.replacingCharacters(in: range, with: string)
+
+        if finishedString?.rangeOfCharacter(from: CharacterSet.letters.inverted) != nil {
+          controller.setErrorText("Only letters allowed.",
+                                  errorAccessibilityValue: "Error: Only letters allowed.")
+        } else {
+          controller.setErrorText(nil, errorAccessibilityValue: nil)
+        }
+        return true
+      }
+    }
+    return true
   }
 }
 

      MDCTextInputControllerUnderline(textInput: textFieldCustomFontFloating)
    textFieldControllerUnderlineCustomFontFloating.characterCountMax = 40
    textFieldControllerUnderlineCustomFontFloating.placeholderText = "This is a custom font with the works"
    textFieldControllerUnderlineCustomFontFloating.helperText = "Custom Font"
    textFieldControllerUnderlineCustomFontFloating.activeColor = .green
    textFieldControllerUnderlineCustomFontFloating.normalColor = .purple
    textFieldControllerUnderlineCustomFontFloating.leadingUnderlineLabelTextColor = .cyan


  @objc func helperSwitchDidChange(helperSwitch: UISwitch) {
    allInputControllers.forEach { controller in
      controller.setHelperText(helperSwitch.isOn ? "This is helper text." : nil,
                               helperAccessibilityLabel: helperSwitch.isOn ? "This is accessible helper text." : nil) 
    }
  }

