Extensions and additions to AsyncSequence, AsyncStream and AsyncThrowingStream.

Overview

Asynchone

Extensions and additions to AsyncSequence, AsyncStream and AsyncThrowingStream.

Requirements

  • iOS 15.0+
  • macOS 12.0+

Installation

Swift Package Manager

In Xcode:

  1. Click Project.
  2. Click Package Dependencies.
  3. Click +.
  4. Enter package URL: https://github.com/reddavis/Asynchrone.
  5. Add Asynchone to your app target.

Documentation

Documentation can be found here.

Overview

AsyncSequence

AsyncStream

AsyncStream.Continuation

AsyncThrowingStream

AsyncThrowingStream.Continuation

License

Whatevs.

Comments
  • Add ThrottleAsyncSequence & AnyAsyncSequence<Element>

    Add ThrottleAsyncSequence & AnyAsyncSequence

    This PR adds ThrottleAsyncSequence & AnyAsyncSequence<Element> which allows to represent AsyncSequence in simmilar way as in Combine AnyPublisher without need to specify Concrete type of sequence.

    opened by m1entus 5
  • Basic DocC support

    Basic DocC support

    You've done an awesome job documenting everything! It's easy, so I thought I'd put together DocC support, along with an .spi.yml, so this will be automatically built and hosted by the Swift Package Index.

    After they rebuilt the package (~ 24 hours), DocC documentation will show up here: https://swiftpackageindex.com/reddavis/Asynchrone

    opened by mattmassicotte 2
  • Add SharedAsyncSequence & ThrottleAsyncSequence

    Add SharedAsyncSequence & ThrottleAsyncSequence

    Not sure why but from forked repo i cannot point to PR which i already created. So i created PR which points to my main which already have throttle changes, so you can take a look here: https://github.com/m1entus/Asynchrone/pull/1/files.

    This PR add shread streams in some way, because originally when you try to await same stream (same Iterator) from multiple Tasks, you will get "_Concurrency/AsyncStreamBuffer.swift:253: Fatal error: attempt to await next() on more than one task" because originally they didn't make AsyncStream Sendable.

    Using SharedAsyncSequence we can share stream across multiple Tasks, this could be helpfull if for example we might to share State stream publisher to multiple objects.

    opened by m1entus 2
  • Both Xcode and SPM?

    Both Xcode and SPM?

    Ok, so I screwed up in #45. I saw that SPM was the only installation method supported and stupidly did not notice the xcodeproj.

    Typically when I use both it is because I need to build something that cannot be described with only a package. In this case, I'm not sure I understand why the Xcode project is needed. Can you help me understand?

    opened by mattmassicotte 1
  • Remove unused date extension

    Remove unused date extension

    This extension, besides overlapping with Foundation, isn't actually used anywhere in the code as far as I could tell. I believe this was left-over and/or missed in https://github.com/reddavis/Asynchrone/pull/6

    opened by mattmassicotte 0
  • Test class had duplicate name

    Test class had duplicate name

    Was just playing around with some tests, and noticed that the test target couldn't build because two classes had the same name. I used the file name as a clue for what to use.

    The contents of the tests are extremely similar but not identical, and I think these really are testing different things. Hope this looks ok, but happy to defer to you!

    opened by mattmassicotte 0
  • Fix issue with task cancellation in `Async(Throwing)?Stream` initializers

    Fix issue with task cancellation in `Async(Throwing)?Stream` initializers

    Asynchrone's custom initializers for AsyncStream and AsyncThrowingStream spawn a new task to wrap the async build block, but do not handling cancelling that task when the AsyncStream is cancelled.

    This resulted in situations where cancellation was failing to propagate to the build block.

    The fix is to use the continuations onTermination block to cancel the newly-spawned task.

    opened by t-sakhuja 0
  • feat: add NotificationCenterAsyncSequence

    feat: add NotificationCenterAsyncSequence

    let sequence = NotificationCenter.default.sequence(for: UIDevice.orientationDidChangeNotification)
    
    for await element in sequence {
        print(element)
    }
    
    opened by reddavis 0
  • feat: add last() to async sequence

    feat: add last() to async sequence

    let sequence = AsyncStream<Int> { continuation in
        continuation.yield(1)
        continuation.yield(2)
        continuation.yield(3)
        continuation.finish()
    }
    
    print(await sequence.last())
    
    // Prints:
    // 3
    
    opened by reddavis 0
  • Improve shared sequence management

    Improve shared sequence management

    The shared sequence would keep hold of all child sequences, even after they were terminated. This could lead to large memory usage if a single shared sequence was used many many times.

    opened by reddavis 0
  • Check for cancellation

    Check for cancellation

    The receive completion handler was never correctly reporting whether the task had been cancelled. It would always return with .finished or an error that was thrown by its sequence.

    opened by reddavis 0
Releases(v0.22.0)
  • v0.22.0(Dec 31, 2022)

    What's Changed

    • feat: first pass at conforming to Sendable by @reddavis in https://github.com/reddavis/Asynchrone/pull/40
    • feat: refactor iterators by @reddavis in https://github.com/reddavis/Asynchrone/pull/41
    • Fix issue with task cancellation in Async(Throwing)?Stream initializers by @t-sakhuja in https://github.com/reddavis/Asynchrone/pull/42
    • fix: a weird bug that appears to cause the iterator to never complete by @reddavis in https://github.com/reddavis/Asynchrone/pull/43
    • Test class had duplicate name by @mattmassicotte in https://github.com/reddavis/Asynchrone/pull/44
    • Remove unused date extension by @mattmassicotte in https://github.com/reddavis/Asynchrone/pull/45
    • Accidentally left deleted file in xcodeproj by @mattmassicotte in https://github.com/reddavis/Asynchrone/pull/46
    • feat: remove use of xcodeproj by @reddavis in https://github.com/reddavis/Asynchrone/pull/48
    • feat: update documentation URL by @reddavis in https://github.com/reddavis/Asynchrone/pull/49
    • Basic DocC support by @mattmassicotte in https://github.com/reddavis/Asynchrone/pull/50
    • watchOS and tvOS by @mattmassicotte in https://github.com/reddavis/Asynchrone/pull/51
    • feat: remove Jazzy documentation by @reddavis in https://github.com/reddavis/Asynchrone/pull/52

    New Contributors

    • @t-sakhuja made their first contribution in https://github.com/reddavis/Asynchrone/pull/42
    • @mattmassicotte made their first contribution in https://github.com/reddavis/Asynchrone/pull/44

    Full Changelog: https://github.com/reddavis/Asynchrone/compare/v0.21.0...v0.22.0

    Source code(tar.gz)
    Source code(zip)
  • v0.21.0(Aug 9, 2022)

    What's Changed

    • feat: add last() to async sequence by @reddavis in https://github.com/reddavis/Asynchrone/pull/36
    • feat: add NotificationCenterAsyncSequence by @reddavis in https://github.com/reddavis/Asynchrone/pull/37

    Full Changelog: https://github.com/reddavis/Asynchrone/compare/v0.20.0...v0.21.0

    Source code(tar.gz)
    Source code(zip)
  • v0.20.0(Jul 7, 2022)

    What's Changed

    • Debounce refactor by @reddavis in https://github.com/reddavis/Asynchrone/pull/33
    • Rethrows & refactoring by @reddavis in https://github.com/reddavis/Asynchrone/pull/34
    • Throttle refactor by @reddavis in https://github.com/reddavis/Asynchrone/pull/35

    Full Changelog: https://github.com/reddavis/Asynchrone/compare/v0.19.0...v0.20.0

    Source code(tar.gz)
    Source code(zip)
  • v0.19.0(Jun 24, 2022)

    What's Changed

    • Improve shared sequence management by @reddavis in https://github.com/reddavis/Asynchrone/pull/32

    Full Changelog: https://github.com/reddavis/Asynchrone/compare/v0.18.1...v0.19.0

    Source code(tar.gz)
    Source code(zip)
  • v0.18.1(Jun 10, 2022)

    What's Changed

    • Check for cancellation by @reddavis in https://github.com/reddavis/Asynchrone/pull/31

    Full Changelog: https://github.com/reddavis/Asynchrone/compare/v0.18.0...v0.18.1

    Source code(tar.gz)
    Source code(zip)
  • v0.18.0(May 26, 2022)

    What's Changed

    • Catch error by @reddavis in https://github.com/reddavis/Asynchrone/pull/30

    Full Changelog: https://github.com/reddavis/Asynchrone/compare/v0.17.0...v0.18.0

    Source code(tar.gz)
    Source code(zip)
  • v0.17.0(May 17, 2022)

    What's Changed

    • [Refactor] Pass priority level to sink function by @reddavis in https://github.com/reddavis/Asynchrone/pull/28

    Full Changelog: https://github.com/reddavis/Asynchrone/compare/v0.16.1...v0.17.0

    Source code(tar.gz)
    Source code(zip)
  • v0.16.1(Apr 11, 2022)

    What's Changed

    • Replace chain operator with a function by @reddavis in https://github.com/reddavis/Asynchrone/pull/26
    • Add the ability to chain sequences by @reddavis in https://github.com/reddavis/Asynchrone/pull/23
    • Make any sequence and async sequence by @reddavis in https://github.com/reddavis/Asynchrone/pull/24
    • Refactor tests by @reddavis in https://github.com/reddavis/Asynchrone/pull/25

    Full Changelog: https://github.com/reddavis/Asynchrone/compare/v0.15.0...v0.16.1

    Source code(tar.gz)
    Source code(zip)
  • v0.15.0(Mar 21, 2022)

    What's Changed

    • Add limit option to collect by @reddavis in https://github.com/reddavis/Asynchrone/pull/20
    • Allow the sink closures to be async by @reddavis in https://github.com/reddavis/Asynchrone/pull/18
    • Introduce TimerAsyncSequence by @reddavis in https://github.com/reddavis/Asynchrone/pull/19
    • Add assign function to async sequence by @reddavis in https://github.com/reddavis/Asynchrone/pull/21
    • Update documentation by @reddavis in https://github.com/reddavis/Asynchrone/pull/22

    Full Changelog: https://github.com/reddavis/Asynchrone/compare/v0.14.0...v0.15.0

    Source code(tar.gz)
    Source code(zip)
  • v0.14.0(Feb 25, 2022)

    What's Changed

    • Update CI to test on iOS 14 too by @reddavis in https://github.com/reddavis/Asynchrone/pull/17
    • DelayAsyncSequence by @reddavis in https://github.com/reddavis/Asynchrone/pull/16
    • Empty sequence by @reddavis in https://github.com/reddavis/Asynchrone/pull/15

    Full Changelog: https://github.com/reddavis/Asynchrone/compare/v0.13.0...v0.14.0

    Source code(tar.gz)
    Source code(zip)
  • v0.13.0(Feb 11, 2022)

    What's Changed

    • Add MIT license by @reddavis in https://github.com/reddavis/Asynchrone/pull/13
    • Add convenience functions to shared async sequence by @reddavis in https://github.com/reddavis/Asynchrone/pull/14

    Full Changelog: https://github.com/reddavis/Asynchrone/compare/v0.12.0...v0.13.0

    Source code(tar.gz)
    Source code(zip)
  • v0.12.0(Jan 27, 2022)

    What's Changed

    • Add Task.sleep that takes seconds by @reddavis in https://github.com/reddavis/Asynchrone/pull/10
    • Add sink functions to AsyncSequence by @reddavis in https://github.com/reddavis/Asynchrone/pull/12

    Full Changelog: https://github.com/reddavis/Asynchrone/compare/v0.11.0...v0.12.0

    Source code(tar.gz)
    Source code(zip)
  • v0.11.0(Jan 7, 2022)

    What's Changed

    • Backwards support iOS 14 by @gshahbazian in https://github.com/reddavis/Asynchrone/pull/6
    • Add PassthroughAsyncSequence and ThrowingPassthroughAsyncSequence by @reddavis in https://github.com/reddavis/Asynchrone/pull/7
    • Refactor shared async sequence by @reddavis in https://github.com/reddavis/Asynchrone/pull/8
    • Add CurrentElementAsyncSequence by @reddavis in https://github.com/reddavis/Asynchrone/pull/9

    New Contributors

    • @gshahbazian made their first contribution in https://github.com/reddavis/Asynchrone/pull/6

    Full Changelog: https://github.com/reddavis/Asynchrone/compare/v0.10.0...v0.11.0

    Source code(tar.gz)
    Source code(zip)
  • v0.10.0(Jan 4, 2022)

    Added

    • Create FUNDING.yml by @reddavis in https://github.com/reddavis/Asynchrone/pull/3
    • Add CI support via GH actions by @reddavis in https://github.com/reddavis/Asynchrone/pull/4
    • Add Swiftlint GH action by @reddavis in https://github.com/reddavis/Asynchrone/pull/5
    • Add SharedAsyncSequence & ThrottleAsyncSequence by @m1entus in https://github.com/reddavis/Asynchrone/pull/2
    • Add DebounceAsyncSequence
    • Add ReplaceErrorAsyncSequence

    New Contributors

    • @m1entus made their first contribution in https://github.com/reddavis/Asynchrone/pull/2

    Full Changelog: https://github.com/reddavis/Asynchrone/compare/v0.9.0...v0.10.0

    Source code(tar.gz)
    Source code(zip)
  • v0.9.0(Dec 24, 2021)

Owner
Red Davis
iOS @ Numan
Red Davis
AsyncTaskKit - contains some additions to async/await Task

AsyncTaskKit This repo contains some additions to async/await Task. In general i

Michał Zaborowski 0 Jan 2, 2022
Type-Erased Existential Generic AsyncSequence Values in Swift

AnyAsyncSequence AnyAsyncSequence allows you to expose AsyncSequence interfaces in your APIs without exposing the underlying sequence type, while cont

Varun Santhanam 9 Nov 23, 2022
Venice - Coroutines, structured concurrency and CSP for Swift on macOS and Linux.

Venice provides structured concurrency and CSP for Swift. Features Coroutines Coroutine cancelation Coroutine groups Channels Receive-only chan

Zewo 1.5k Dec 22, 2022
Make your logic flow and data flow clean and human readable

Flow What's Flow Flow is an utility/ design pattern that help developers to write simple and readable code. There are two main concerns: Flow of opera

null 18 Jun 17, 2022
Async and concurrent versions of Swift’s forEach, map, flatMap, and compactMap APIs.

CollectionConcurrencyKit Welcome to CollectionConcurrencyKit, a lightweight Swift package that adds asynchronous and concurrent versions of the standa

John Sundell 684 Jan 9, 2023
straightforward networking and error handling with async-await and URLSession

AsyncAwaitNetworkingPlayground How To Run Just clone the project, open it and run. Some notes about AsyncAwaitNetworkingPlayground It's a straightforw

Fırat Yenidünya 17 Dec 11, 2022
Slack message generator and API client, written in Swift with Result Builders and Concurrency

Slack Message Client This package provides a Swift object model for a Slack Block Kit message, as well as a Result Builder convenience interface for e

Mike Lewis 2 Jul 30, 2022
Automatically generate GraphQL queries and decode results into Swift objects, and also interact with arbitrary GitHub API endpoints

GitHub API and GraphQL Client This package provides a generic GitHub API client (GithubApiClient) as well as Codable-like GitHub GraphQL querying and

Mike Lewis 4 Aug 6, 2022
A complete set of primitives for concurrency and reactive programming on Swift

A complete set of primitives for concurrency and reactive programming on Swift 1.4.0 is the latest and greatest, but only for Swift 4.2 and 5.0 use 1.

AsyncNinja 156 Aug 31, 2022
GroupWork is an easy to use Swift framework that helps you orchestrate your concurrent, asynchronous functions in a clean and organized way

GroupWork is an easy to use Swift framework that helps you orchestrate your concurrent, asynchronous functions in a clean and organized way. This help

Quan Vo 42 Oct 5, 2022
Queuer is a queue manager, built on top of OperationQueue and Dispatch (aka GCD).

Queuer is a queue manager, built on top of OperationQueue and Dispatch (aka GCD). It allows you to create any asynchronous and synchronous task easily, all managed by a queue, with just a few lines.

Fabrizio Brancati 1k Dec 2, 2022
SwiftCoroutine - Swift coroutines for iOS, macOS and Linux.

Many languages, such as Kotlin, Go, JavaScript, Python, Rust, C#, C++ and others, already have coroutines support that makes the async/await pattern i

Alex Belozierov 808 Dec 1, 2022
SwiftyTimer allows you to instantly schedule delays and repeating timers using convenient closure syntax. It's time to get rid of Objective-C cruft.

SwiftyTimer Modern Swifty API for NSTimer SwiftyTimer allows you to instantly schedule delays and repeating timers using convenient closure syntax. It

Radek Pietruszewski 1.2k Dec 27, 2022
A demonstration for bridging between Combine and your new async functions

CombineAsyncually This is a DEMONSTRATION of how you can bridge the new async / await functionality in Swift 5.5 with Combine. There is NO WARRANTY. T

null 48 Dec 4, 2022
Queues, timers, and task groups in Swift

Dispatcher eases the pain of using Grand Central Dispatch by introducing 4 new Swift classes. Dispatcher Queue Group Timer Requirements Swift 2.0+ Ins

Alec Larson 109 Jan 29, 2022
Syntactic sugar in Swift for asynchronous dispatches in Grand Central Dispatch (iOS7+ and OS X 10.9+ compatible)

Async.legacy Syntactic sugar in Swift for asynchronous dispatches in Grand Central Dispatch (GCD) Async rewritten for iOS7 and OS X 10.9 Compatibility

Joseph Lord 31 Jul 1, 2019
React Native FlyBuy module. Supports Core, Pickup, Notify, and Presence Native SDK APIs.

The FlyBuy cloud service and mobile SDK enables developers to add FlyBuy functionality directly into their react native apps for a full white label im

BILDIT, LLC. 8 Sep 16, 2022
A Swift DSL that allows concise and effective concurrency manipulation

NOTE Brisk is being mothballed due to general incompatibilities with modern version of Swift. I recommend checking out ReactiveSwift, which solves man

Jason Fieldman 25 May 24, 2019
⚡️ Fast async task based Swift framework with focus on type safety, concurrency and multi threading

Our apps constantly do work. The faster you react to user input and produce an output, the more likely is that the user will continue to use your appl

Said Sikira 814 Oct 30, 2022