0

i have a problem with the next code:

func +=! (tasks: inout [TaskQueue.ClosureWithResultNext], task: @escaping TaskQueue.ClosureWithResultNext) {
tasks += [{
    result, next in
    DispatchQueue.main.async(execute: {
        task(result, next)
    })
}] }



func +=! (tasks:inout [TaskQueue.ClosureWithResultNext], task: @escaping TaskQueue.ClosureNoResultNext) {
tasks += [{
    _, next in
    DispatchQueue.main.async{
        task()
        next(nil)
    }
}]}

And i get problem with next with non-escaping parameter, if somebody could help me please with these problem.

Full error message is Closure use of non-escaping parameter 'next' may allow it to escape.

Thanks.

Tcacenco Daniel
  • 445
  • 7
  • 17
  • Compiles fine for me with the latest version of TaskQueue – on what line do you get the error, and what's the full error message? – Hamish Nov 09 '16 at 13:30
  • Full error message is Closure use of non-escaping parameter 'next' may allow it to escape. – Tcacenco Daniel Nov 09 '16 at 14:19

0 Answers0