You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
enum TextFieldError: Error {
case emptyTextField
}
extension TextFieldError: LocalizedError {
public var errorDescription: String? {
switch self {
case .emptyTextField:
return "Here, the string you want to display below the text field"
}
}
}
Then, you can use later it as :
if titleTextField.text == "" {
let error: Error = TextFieldError.emptyTextField
titleTextField.setError(error, animated: true)
}
Activity
Arth1sBack commentedon Sep 3, 2020
Here's my suggestion :
Start by defining your own error type like :
Then, you can use later it as :
Hope it will help
PhenomenalMatrix commentedon May 14, 2022
how to turn off error state