Created
July 4, 2025 13:42
-
-
Save jacobsapps/dce791c7ff981aa0822b597a68175013 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
async let user = fetchUser(id: 1) | |
async let posts = fetchPosts(userId: 1) | |
async let friends = fetchFriends(userId: 1) | |
// no suspension yet | |
// execution kicks off all child tasks immediately | |
// suspension only happens at the first await | |
self.user = await user // fetchUser() async | |
self.posts = try? await posts // fetchPosts() async throws | |
self.friends = try await friends // fetchFriends() async throws |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment