-
-
Save byaruhaf/08f8142a751e71e3cbb28582c403417e to your computer and use it in GitHub Desktop.
DispatchWorkItem notify example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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