Last active
February 23, 2022 02:16
-
-
Save Edudjr/6c29de366531cb1f8de36d9b379b093f to your computer and use it in GitHub Desktop.
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
struct API { | |
//... | |
func loadTodo() -> AnyPublisher<Todo, Error> { | |
//... | |
} | |
} | |
class Client1 { | |
// 1. Make function async | |
func loadTodo() async { | |
do { | |
// 2. Call async() on AnyPublisher | |
let todo = try await api.loadTodo().async() | |
//... | |
} catch { | |
//... | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment