Useful extensions built upon Swift Concurrency

What's New


  • Refactor AsyncInputStream to make better use of Swift Concurrency.


The AsyncExtensions target is a growing collection of useful functions and classes that take advantage of Swift's new Concurrency features.

The AsyncExtensions package also inlcudes the AsyncTestExtensions target, which contains async-friendly wrappers around XCTest assertions.

AsyncExtensions includes

  • AsyncInputStream: A convenient wrapper around InputStream allowing for simple, type-safe access to stream data.
  • CombineAsyncStream: A backported version of AsyncPublisher, which creates an AsyncStream from a Combine Publisher and is only supported on iOS 15+.
  • Future: A thread-safe implemention of a future that is useful when briding traditional Swift code with code employing Swift Concurrency.
  • Sequence.asyncMap() and Sequence.concurrentMap(): Extensions allowing for applying async transformations to Sequence.
  • TimeoutError: A simple error intending to represent a timeout. Modelled after CancellationError.

AsyncTestExtensions includes

  • AssertEqual()
  • AssertEqualEventually()
  • AssertTrue()
  • AssertTrueEventually()
  • AssertFalse()
  • AssertNil()
  • AssertNotNil()
  • AssertThrowsError()
  • AssertNoThrow()


To use AsyncExtensions, add a dependency to your Package.swift file:

let package = Package(
  dependencies: [
      url: "",
      from: "2.2.0"

To use AsyncTestExtensions in a test target, add it as a dependency:

  name: "MyTests",
  dependencies: [
    .product(name: "AsyncTestExtensions", package: "async-extensions")


The license for AsyncExtensions is the standard MIT licence. You can find it in the LICENSE file.

CombineAsyncStream was created by Marin Todorov. It was released on his blog at

SequenceExtensions were heavily inspired by CollectionConcurrencyKit by John Sundell at


  • Swift Tools 5.7.0
View More Packages from this Author


Last updated: Thu Jan 12 2023 17:20:36 GMT-0500 (GMT-05:00)