Skip to content

Instantly share code, notes, and snippets.

@lahariganti
Created September 28, 2021 12:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lahariganti/f13e29d8be294fdf8a755e74ee52af6d to your computer and use it in GitHub Desktop.
Save lahariganti/f13e29d8be294fdf8a755e74ee52af6d to your computer and use it in GitHub Desktop.
AsyncSequence to Sequence
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