What about simply allowing other expressions as long as they evaluate to ()?
let backgroundColor: Color =
switch colorScheme {
case .light: .white
case .dark: .charcoal
@unknown default:
// Upon writing this I realized that it
// would parse as `Void.white`, and that
// therefore we should have some keyword or sigil...
log("Unrecognized `colorScheme`: \(colorScheme)")
.white
}
I'll throw -> into the ring for consideration, even though leaving aside the stylistic question it might be completely untenable just in terms of parsing complexity:
let backgroundColor: Color =
switch colorScheme {
case .light: .white
case .dark: .charcoal
@unknown default:
log("Unrecognized `colorScheme`: \(colorScheme)")
-> .white
}