-
-
Save laevandus/38d50fca70322539d60c5f6d90ab6870 to your computer and use it in GitHub Desktop.
This file contains 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
let imageDatas = try await withThrowingTaskGroup(of: Data.self, returning: [Data].self) { group in | |
imageIdentifiers.forEach { imageIdentifier in | |
group.addTask { | |
return try await ImageProcessor.process(identifier: imageIdentifier) | |
} | |
} | |
var results = [Data]() | |
for try await imageData in group { | |
results.append(imageData) | |
} | |
return results | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment