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.