What are trailing closures in Swift?

When we have a long closure expression as a final argument to a function, then we can write the closure expression outside the function parentheses even though it is part of function call. Such closures are called trailing closures. When we us trailing closure, we don’t have to use the argument label for the closure in the function call.

 

Leave a Reply

%d bloggers like this: