SE-0279: Multiple Trailing Closures

I would not characterize function builders as an "aesthetic language change," given their impact on the language. But I would also point out that function builders are not (yet) an official part of Swift. As to single-line returns, I think you'll find that I've been consistent in my line of thinking.

I do. Why the need for the outer braces? Labeled arguments with trailing colons are necessary for disambiguation as has been amply explained before; but they are (unless I'm missing something) sufficient also.

// Single trailing closure
func foo(bar) { ... }

// Single trailing closure with spelled-out closure label
func foo(bar)
  success: { ... }

// Actually multiple trailing closures
func foo(bar)
  success: { ... }
  failure: { ... }

13 Likes