Async let explained: call async functions in parallel - SwiftLee

PHOTO EMBED

Sat Jul 09 2022 12:10:13 GMT+0000 (Coordinated Universal Time)

Saved by @crsvld #swift

func loadImages() {
    Task {
        let firstImage = await loadImage(index: 1)
        let secondImage = await loadImage(index: 2)
        let thirdImage = await loadImage(index: 3)
        let images = [firstImage, secondImage, thirdImage]
    }
}
content_copyCOPY

https://www.avanderlee.com/swift/async-let-asynchronous-functions-in-parallel/