Created
October 11, 2016 22:37
-
-
Save joshavant/704600010df661a8d7b8266421996599 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
enum BirthdateValidation { | |
case valid(Date) | |
case missingComponents(Set<Birthdate.Component>) | |
case notOldEnough | |
init(date: Birthdate?) { | |
// implement validation for all states | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On second thought, I might model this as an
OptionSet
so there can be multiple concurrent states.