Skip to content

Instantly share code, notes, and snippets.

@joshavant
Created October 11, 2016 22:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshavant/704600010df661a8d7b8266421996599 to your computer and use it in GitHub Desktop.
Save joshavant/704600010df661a8d7b8266421996599 to your computer and use it in GitHub Desktop.
enum BirthdateValidation {
case valid(Date)
case missingComponents(Set<Birthdate.Component>)
case notOldEnough
init(date: Birthdate?) {
// implement validation for all states
}
}
@joshavant
Copy link
Author

On second thought, I might model this as an OptionSet so there can be multiple concurrent states.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment