Swiftpack.co - vsanthanam/AnyAsyncSequence as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by vsanthanam.
vsanthanam/AnyAsyncSequence 1.0.2
Type-Erased Existential Generic AsyncSequence Values in Swift
⭐️ 4
🕓 2 weeks ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/vsanthanam/AnyAsyncSequence.git", from: "1.0.2")

AnyAsyncSequence

MIT License Package Releases Build Results Swift Version Supported Platforms

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.

Installation

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: "https://github.com/vsanthanam/AnyAsyncSequence.git", .upToNextMajor(from: "1.0.0"))
]

To add AnyAsyncSequence as a dependency to an Xcode Project:

  • Choose FileAdd Packages...
  • Enter package URL https://github.com/vsanthanam/AnyAsyncSequence.git and select your release and of choice.

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

Additional installation instructions are available on the Swift Package Index

Usage

import AnyAsyncSequence

var mySequence: AnyAsyncSequence<Element> {
    myTypedSequence.eraseToAnyAsyncSequence()
}

Explore the documentation for more details.

License

AnyAsyncSequence is available under the MIT license. See the LICENSE file for more information.

GitHub

link
Stars: 4
Last commit: 2 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

1.0.2
2 weeks ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics