I would like to call an @autoclosure parameter inside dispatch_async
block.
func myFunc(@autoclosure condition: () -> Bool) {
dispatch_async(dispatch_get_main_queue()) {
if condition() {
println("Condition is true")
}
}
}
I get the following error.
Closure use of @noescape parameter may allow it to escape.
Is it possible to call @autoclosure parameter asynchronously?
Tested in Xcode 6.4 (6E23).