GCDKit icon indicating copy to clipboard operation
GCDKit copied to clipboard

nice kit. any sample about task queue?

Open leancmscn opened this issue 8 years ago • 2 comments

uploadQueen = GDDQueue("upload") uploadQueen.addTask([task1, task2, task3]).notify({

all task finished!

})

like this

leancmscn avatar Jul 20 '16 09:07 leancmscn

@leancmscn The README file shows an example using GCDGroups: https://github.com/JohnEstropia/GCDKit#launching-and-reporting-completion-of-a-group-of-tasks

Isn't this what you are looking for?

JohnEstropia avatar Jul 20 '16 10:07 JohnEstropia

GCDGroups not suit for unlimited task, only suit for tasks added one by one.

let dispatchGroup = GCDGroup()

dispatchGroup.enter()
doSomeLongTaskWithCompletion {
    dispatchGroup.leave()
}

for task in tasks {
      dispatchGroup.async(.Default) {
            task
      }
}
dispatchGroup.notify(.Main) {
    // report completion
}

right?

leancmscn avatar Jul 27 '16 09:07 leancmscn