Created
March 19, 2025 07:21
-
-
Save gaeng2y/41fbf86b7556990df51f107a648c8d22 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
| func fetchThumbnails(for ids: [String]) async throws -> [String: UIImage] { | |
| var thumbnails: [String: UIImage] = [:] | |
| try await withThrowingTaskGroup(of: Void.self) { group in | |
| for id in ids { | |
| group.async { | |
| // Error: Mutation of captured var 'thumbnails' in concurrently executing code | |
| thumbnails[id] = try await fetchOneThumbnail(withID: id) | |
| } | |
| } | |
| } | |
| return thumbnails | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment