Created
April 18, 2022 08:54
-
-
Save gaeng2y/636d2559d417dd25b5f50f34eb44c57b to your computer and use it in GitHub Desktop.
비동기 코드
This file contains 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 af(_ nums: [Int], _ result: @escaping (Int) -> Void) { | |
DispatchQueue.main.async { | |
sleep(1) | |
let sum = nums.reduce(0, +) | |
result(sum) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment