Skip to content

Instantly share code, notes, and snippets.

@Edudjr
Last active February 23, 2022 02:16
Show Gist options
  • Save Edudjr/6c29de366531cb1f8de36d9b379b093f to your computer and use it in GitHub Desktop.
Save Edudjr/6c29de366531cb1f8de36d9b379b093f to your computer and use it in GitHub Desktop.
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