Skip to content

3.2.0

Latest

Choose a tag to compare

@velocityzen velocityzen released this 11 Jun 14:05
· 1 commit to main since this release
b0f4eff

Parallel array traversal, explicit sequential/parallel documentation across the async APIs, and a much better documentation experience on Swift Package Index.

✨ New

  • Parallel traverseAsync(concurrency:) — traverse an array with up to concurrency transforms in flight at once, in both the plain and Result-returning forms:
    let users = await userIds.traverseAsync(concurrency: 4) { id in
        await fetchUser(id: id)
    }
    Results keep source order, the lowest-index failure wins deterministically (even when several elements fail at once), and a failure stops new transforms and cancels in-flight ones cooperatively. concurrency: 1 behaves exactly like the sequential variant. The parameter is required — existing sequential calls keep compiling unchanged, with no new Sendable requirements.

🔧 Improvements

  • Sequential behavior is now documented everywhere it applies: traverseAsync, mapAsync, flatMapAsync, and compactMapAsync on Array all state that transforms run one at a time, with pointers to the parallel options.
  • New "choosing between them" guidance for traverseAsync(concurrency:) vs mapAsyncKeepOrder — all-or-nothing over a finite array vs streaming ordered results from any (possibly endless) source with failures kept in position. Available in the README, the DocC overview, and both APIs' doc comments.
  • DocC pages on Swift Package Index are fixed and fleshed out:
    • The merged Result extensions page no longer mislabels itself "Result+tap" — all five extended types (Result, Optional, Array, AsyncSequence, AsyncStream) now have proper curated page abstracts.
    • Three previously broken (ambiguous) symbol links now resolve.
    • The documentation overview gained sections that were missing: Boolean Checks (isSuccess/isFailure), Transforming Errors (mapErrorAsync), plus matchAsync, letAsync, fromTask, and finishWithFailure examples.

🛠 Under the Hood

  • 431 tests (up from 423), including determinism proofs for the parallel traverse: ordering under inverted latency, concurrency-cap enforcement, lowest-index failure precedence, and cancellation of in-flight transforms on failure.