Swiftpack.co - shareup/async-extensions as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by shareup.
shareup/async-extensions v3.0.1
Useful extensions built upon Swift Concurrency
⭐️ 4
🕓 Yesterday
iOS macOS watchOS tvOS
.package(url: "https://github.com/shareup/async-extensions.git", from: "v3.0.1")

AsyncExtensions

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.
  • AsyncOutputStream: A convenient wrapper around OutputStream allowing for simple, type-safe streaming of 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.
  • TaskStore: A thread-safe store for Task, which can help when migrating from Combine publishers to Swift Concurrency.
  • TimeoutError: A simple error intending to represent a timeout. Modelled after CancellationError.

AsyncTestExtensions includes

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

Installation

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

let package = Package(
  dependencies: [
    .package(
      url: "https://github.com/shareup/async-extensions.git",
      from: "3.0.0"
    )
  ]
)

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

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

License

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 https://trycombine.com/posts/combine-async-sequence-2/.

SequenceExtensions were heavily inspired by CollectionConcurrencyKit by John Sundell at https://github.com/JohnSundell/CollectionConcurrencyKit.

GitHub

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

Dependencies

Release Notes

Yesterday
  • Update .swiftformat

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