Skip to content

Instantly share code, notes, and snippets.

@azamsharp
Created October 24, 2017 16:25
Show Gist options
  • Save azamsharp/67e79e31263199df3a9c8878ab7b7075 to your computer and use it in GitHub Desktop.
Save azamsharp/67e79e31263199df3a9c8878ab7b7075 to your computer and use it in GitHub Desktop.
@IBAction func save() {
var errors = [String]()
if (viewModel.newPassword.value?.count)! < 8 {
errors.append("Password should be at least 8 characters long")
}
if viewModel.newPassword.value != viewModel.confirmPassword.value {
errors.append("Password is not matching")
}
if errors.count == 0 {
// update the password
} else {
// show the errors
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment