Created
August 5, 2018 23:04
-
-
Save Arrlindii/669d5f14f85ff9a625f5e2165925db64 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
func validate() { | |
do { | |
let email = try emailTextField.validatedText(validationType: ValidatorType.email) | |
let username = try usernameTextField.validatedText(validationType: ValidatorType.username) | |
let age = try self.ageTextField.validatedText(validationType: ValidatorType.age) | |
let password = try passwordTextField.validatedText(validationType: ValidatorType.password) | |
let projectId = try projectIdTextField.validatedText(validationType: ValidatorType.projectIdentifier) | |
let department = try self.departmentTextField.validatedText(validationType: .requiredField(field: "Department")) | |
let data = RegisterData(email: email, password: password, username: username, projectID: projectId, department: department, age: Int(age)!) | |
save(data) | |
} catch(let error) { | |
showAlert(for: (error as! ValidationError).message) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment