#89: async let in Swift

When you have a small fixed number of async operations that can run in parallel, async let is a very nice fit.

async let user = fetchUser()
async let posts = fetchPosts()

let result = await (user, posts)

This keeps the code compact while still using structured concurrency: the child tasks stay tied to the parent scope.

For dynamic numbers of tasks, task groups are usually a better tool.


I'm also on Twitter and GitHub.

Subscribe via RSS.