4 ms·
> Is there some kind of embedded DSL stuff going on here? Exactly. It's a (at this point, unofficial) Swift feature called "function builders." The types end
by favorited 7y ago
> Is there some kind of embedded DSL stuff going on here?
Exactly. It's a (at this point, unofficial) Swift feature called "function builders." The types end up being the same, because the conditionals are represented as wrapper types.
So
if count == 0 {
EmptyView()
} else {
Text("\(count)")
}
would result in a type something like `Conditional<EmptyView, Text>`.
https://github.com/apple/swift-evolution/blob/9992cf3c11c2d5e0ea20bee98657d93902d5b174/proposals/XXXX-function-builders.md https://github.com/apple/swift-evolution/blob/9992cf3c11c2d5...