Created
March 4, 2020 14:32
-
-
Save azamsharp/a903584db083b3fdeb06e47732587017 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Published private (set) var brokenRules: [BrokenRule] = [BrokenRule]() | |
func validate() { | |
brokenRules.removeAll() | |
let rules = [ | |
"Firstname": _firstname.validationError, | |
"Lastname": _lastname.validationError, | |
"Username": _username.validationError, | |
"Password": _password.validationError | |
] | |
_ = rules.compactMap { pair -> Void in | |
guard let errorMessage = pair.1?.failureReason else { return } | |
brokenRules.append(BrokenRule(name: pair.0, message: errorMessage)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment