Hey Brian! Why did you use a more basic and not really user-friendly approach for the birthday field this time? I would have expected a UIDatePicker to get rid of unnecessary form validation and typing. Really enjoying this course, man! The tuples and protocols helped me out so much.
For my own application I use a struct in conjunction with a function to throw different alerts. Very convenient if you have lots of different alert boxes to show within your app.
enum AlertType {
case mailError, mailSuccess, mailConfigure
case userError, userLoginEmpty, userLoginIncorrect
}
struct Alert {
static func showAlert(ofType type: AlertType, handler: ((UIAlertAction) -> ())? = nil) -> UIAlertController {
var message: String
case .mailError:
message = “Could not send email message.”
case .mailSuccess:
message = “Email has been sent.“
case .mailConfigure:
message = “Could not configure email account.“
case .userError:
message = “An error has occurred. Please try again.“
case .userLoginEmpty:
message = “Please enter your username and password to login. “
case .userLoginIncorrect:
message = “Incorrect username and/or password..“
}
let alert = UIAlertController(title: "Message", message: message, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: handler))
return alert
}
}