Skip to content

Instantly share code, notes, and snippets.

@chrsp
Last active January 25, 2021 14:32
Show Gist options
  • Save chrsp/2b32243e5261879a22c3ce3904397753 to your computer and use it in GitHub Desktop.
Save chrsp/2b32243e5261879a22c3ce3904397753 to your computer and use it in GitHub Desktop.
// Module: Data
import Domain
public struct: ItalianCooker: CookerProtocol {
func cook(_ recipe: Recipe) {
switch recipe {
case recipe is SpaghettiCarbonara:
cookSpaghettiCarbonara(recipe)
default:
print("Cooker doesn't know how to cook the recipe requested")
}
private func cookSpaghettiCarbonara(_ carbonara: SpaghettiCarbonara) {
// do something with the carbonara ingredients
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment