Created
August 17, 2019 13:37
-
-
Save standinga/0d8a20af936083b1fd10e4bfec654997 to your computer and use it in GitHub Desktop.
fetchData function for medium blog post about DispatchGroup and DispatchSemaphore, https://link.medium.com/zJMQPUHaeZ
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
func fetchData(_ data: Int, delay: Double, completionHandler: @escaping (String)->()) { | |
DispatchQueue.main.asyncAfter(deadline: .now() + delay) { | |
completionHandler("\(data)") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment