Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'ViewController' does not conform to protocol 'ValidationDelegate' #207

Open
gauravparvadiya opened this issue Jun 21, 2018 · 2 comments
Open

Comments

@gauravparvadiya
Copy link

Hi,

I have added ValidationDelegate to my viewController and also implementing both required methods. But still, I am getting "Does not conform to protocol" error.

I am using Xcode 9.3 and Swift 4.1

@IslamAbdelAziz
Copy link

Same using Xcode 11, Swift 5

@rehmantalha
Copy link

I am using Xcode 12.5, swift 5 faced the same error, but instead of using the

validator.validate(self) and implementing the protocol i used the callback function

validator.validate { [weak self] errors in
    guard let self = self else { return }
    if errors.count > 0 {
        for (field, error) in errors {
            if let field = field as? UITextField {
              field.layer.borderColor = UIColor.red.cgColor
              field.layer.borderWidth = 1.0
            }
            error.errorLabel?.text = error.errorMessage // works if you added labels
            error.errorLabel?.isHidden = false
        }
    } else {
        // success in validation
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants