I get your point, but the variable used in the function body is the one having as its name the parameter name. I think that the annotation should be placed near the parameter name for that reason. Argument labels are just decorative and are not used in the function body. They are related to the parameter but not in the same way var
, private
or @Lazy
are, in my opinion.
As for your example, the first case would be the right one, since @ViewBuilder
is attached to x
.
func footer(@ViewBuilder x: () -> View)
Pitch #2: Extend Property Wrappers to Function and Closure Parameters - #23 by xAlien95 may be a more appropriate thread for this side discussion. I quoted my post there too.