Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
NewGenerics3
enum PizzaType: String, RestaurantItem {
case margherita = "Margherita"
case farmhouse = "Farmhouse"
case goldenCorn = "Golden corn"
var toppings: [PizzaTopping] {
switch self {
case .margherita:
return [.lotsOfCheese]
case .farmhouse:
return [.corn, .capsicum, .onion, .cheese]
case .goldenCorn:
return [.corn, .cheese]
}
}
func acceptOrderItem() -> String {
"\(self.rawValue) pizza in preparation"
}
func prepareOrderItem() -> String {
"\(self.rawValue) pizza is ready!"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment