Skip to content

Instantly share code, notes, and snippets.

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 SahilMutualMobile/137f879f55e78bf18ed57d12c8e46409 to your computer and use it in GitHub Desktop.
Save SahilMutualMobile/137f879f55e78bf18ed57d12c8e46409 to your computer and use it in GitHub Desktop.
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