Created
October 6, 2021 10:59
-
-
Save denandreychuk/7f57259d5b0e9e649b66e85ce1165b34 to your computer and use it in GitHub Desktop.
Асинхронные скрипты на Swift | https://t.me/BlogSwift
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 someAsyncFunc(result: @escaping (Result<Void, Error>) -> Void) { | |
| DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(3)) { | |
| result(.success(())) | |
| } | |
| } | |
| let runner = SwiftScriptRunner() | |
| runner.lock() | |
| someAsyncFunc { result in | |
| // Handle result | |
| runner.unlock() | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment