SE-0289 (review #2): Result Builders

As an uneducated Swift user (which I am) I would probably try with this placement at first. Property wrappers are applied to variables, so I would intuitively expect them to be on the left of the parameter name in this case instead of having them on the left of the argument label (which usually is a preposition unrelated to the parameter).

@Lazy private var a: Int = 0
// 'a' is @Lazy, a variable and private

@available(iOS 14, *)
public let b: String = ""
// 'b' is available in iOS 14+, it is a constant and public

@propertyWrapper struct Wrapper { ... }
// 'Wrapper' is a @propertyWrapper and a struct
func footer<V: View>(@ViewBuilder from footer: () -> V) -> some View { ... }

In this case footer is a @ViewBuilder, but the parameter label from doesn't describe the parameter. It's a "gap" in the reading flow if we may say.

func footer<V: View>(from @ViewBuilder footer: () -> V) -> some View { ... }

It's a subtle difference, but placing the annotation between the argument label and the parameter name feels more natural while reading the code.

2 Likes