Created
September 28, 2021 12:40
-
-
Save lahariganti/f13e29d8be294fdf8a755e74ee52af6d to your computer and use it in GitHub Desktop.
AsyncSequence to Sequence
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
extension AsyncSequence { | |
func collect() async rethrows -> [Element] { | |
try await reduce(into: [Element]()) { $0.append($1) } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment