MIT License Swift 5.6 iOS | macOS | tvOS | watchOS GitHub release (latest by date)

AnyAsyncSequence allows you to expose AsyncSequence interfaces in your APIs without exposing the underlying sequence type, while continuing to expose the sequence’s Element type to consumers, so they can asynchronously iterate over the sequence.

I assume that when Swift adds type constraints to opaque types (as has been hinted), this package may become unnecessary.

import AnyAsyncSequence

var mySequence: AnyAsyncSequence<Element> {

Explore the documentation for more details.


AnyAsyncSequence currently distributed exclusively through the Swift Package Manager.

To add AnyAsyncSequence as a dependency to an existing Swift package, add the following line of code to the dependencies parameter of your Package.swift file:

dependencies: [
    .package(url: "", .upToNextMajor(from: "1.0.0"))

To add AnyAsyncSequence as a dependency to an Xcode Project:

  • Choose FileAdd Packages...
  • Enter package URL and select your release and of choice.

Other distribution mechanisms like CocoaPods or Carthage may be added in the future.


If you find this package useful, checkout some of my others


View Github