Skip to content

Instantly share code, notes, and snippets.

@Kdan
Created April 10, 2018 17:35
Show Gist options
  • Save Kdan/7b6968e1c089eee3825321c294b6985a to your computer and use it in GitHub Desktop.
Save Kdan/7b6968e1c089eee3825321c294b6985a to your computer and use it in GitHub Desktop.
/// The PetFamily enum describes the Pet family of objects.
enum PetFamily: String, ClassFamily {
case cat = "Cat"
case dog = "Dog"
static var discriminator: Discriminator = .type
func getType() -> AnyObject.Type {
switch self {
case .cat:
return Cat.self
case .dog:
return Dog.self
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment