Trailing Closure Syntax

suggest change

When the last parameter of a function is a closure

func loadData(id: String, completion:(result: String) -> ()) {
    // ...
    completion(result:"This is the result data")
}

the function can be invoked using the Trailing Closure Syntax

loadData("123") { result in
    print(result)
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents