Skip to content

Instantly share code, notes, and snippets.

@laevandus
Created July 10, 2023 09:06
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 laevandus/6ec720c4021357b7768ff210290d502c to your computer and use it in GitHub Desktop.
Save laevandus/6ec720c4021357b7768ff210290d502c to your computer and use it in GitHub Desktop.
enum BrewMethod {
case espresso, frenchPress, chemex
}
// Before
func backgroundColor(for method: BrewMethod) -> UIColor {
switch method {
case .espresso: return .systemBrown
case .frenchPress: return .systemCyan
case .chemex: return .systemMint
}
}
// After
func backgroundColor(for method: BrewMethod) -> UIColor {
switch method {
case .espresso: .systemBrown
case .frenchPress: .systemCyan
case .chemex: .systemMint
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment