Swiftpack.co - AsyncSwiftKits/AsyncChannelKit as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by AsyncSwiftKits.
AsyncSwiftKits/AsyncChannelKit v0.0.7
Simple implementation of an async channel for use with Swift Concurrency
⭐️ 9
🕓 1 year ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/AsyncSwiftKits/AsyncChannelKit.git", from: "v0.0.7")

AsyncChannelKit

CI

A simple implementation of an async channel for use with AsyncSequence and AsyncIterator which matches the same interface as Channel.

When the next() function is called it is expected to return a value asynchronusly for an async for loop. If the values are not created in response to calling this function these values will have to be provided somehow. This channel supports sending values which the next() can return.

In the unit tests, a channel is created which is also a sequence. The AyncIterator is a nested type. When the iterator is created it is given the same channel. Calling send on the channel will make new values available. When the next function is called it creates a continuation which will be matched to a value so it can be returned. Calling terminate will use a continuation to send nil which tells the for loop it is done.

All of the work done by the channel is done as an actor type so that it is thread-safe. Since it only uses features from the Swift Standard Library it should be usable on every platform which has Swift support.

GitHub

link
Stars: 9
Last commit: 1 year ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

Release 0.0.7
1 year ago

Uses latest release of AsyncTesting to drop try from calls to waitForExpectations.

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