Skip to content

Instantly share code, notes, and snippets.

@yostane
Created February 12, 2017 12:09
Show Gist options
  • Select an option

  • Save yostane/a05c3a0b04ef1c7795becfabfd89159e to your computer and use it in GitHub Desktop.

Select an option

Save yostane/a05c3a0b04ef1c7795becfabfd89159e to your computer and use it in GitHub Desktop.
DispatchWorkItem notify example
let dwi3 = DispatchWorkItem {
print("start DispatchWorkItem")
sleep(2)
print("end DispatchWorkItem")
}
//this block will be executed on a the siqpatch queue 'dq' when dwi3 completes
let myDq = DispatchQueue(label: "A custom dispatch queue")
dwi3.notify(queue: myDq) {
print("notify")
}
DispatchQueue.global().async(execute: dwi3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment