I'm new to Swift and looking at how the dispatch_async function works. The API doc shows dispatch_async having two parameters. However, I'm able to pass in one argument and it's okay.
dispatch_async(dispatch_get_main_queue()) {
}
How come I don't need to pass in two arguments?
Thank you,
API Doc:
It is a trailing closure syntax
https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Closures.html
This is how the dispatch_async looks like..
this part
is the second parameter to your function, which is an anonymous code block used for callBack implementation.