-
-
Save vincent-pradeilles/7bcac9e2a6813ddf70a0328c119229f1 to your computer and use it in GitHub Desktop.
This file contains 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
struct AccountNumber { | |
let number: String | |
init?(untrustedAccountNumber: Untrusted<String>) { | |
guard let validAcountNumber = AccountNumberValidator.validate(untrusted: untrustedAccountNumber) | |
else { | |
return nil | |
} | |
self.number = validAcountNumber | |
} | |
} | |
struct AccountNumberValidator: Validator { | |
static func validation(value: String) -> Bool { | |
return isValidAccountNumber(value) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment