Created
February 12, 2017 12:09
-
-
Save yostane/a05c3a0b04ef1c7795becfabfd89159e 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