Created
February 3, 2022 16:05
-
-
Save SebastianBoldt/e15651f4f91910f57124bbc8d02e27d3 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
let task = Task { () -> String in | |
let text = try await requestTextFromServer() | |
return text | |
} | |
let result = try await task.result | |
switch result { | |
case let .success(value): | |
print(value) | |
case let .failure(error): | |
print(error) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment