About closure vs function, I don't think it's at all about labels. In fact, if I want to use Lowercased
, I'd pretty much expect the closure to take in String
. If I see this:
ForEach(...) { (@Lowercased string) in
...
}
I'd expect that it operates on an array of String
instead of Lowercased
.
The opposite happens with Binding
. If I'm using it, I'd pretty much prefer that it's passed as Binding<X>
regardless of where it actually is declared.
// Should be called with `foo(someBinding)`
func foo(@Binding x: Int)
// Expecting an array of `Binding`
ForEach(...) { (@Binding value) in
}
The type of argument passing seems to depend more on the [type of the wrapper] than the [function vs closure].