Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

XCEssentials/XCEPipeline

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

294 Commits
294 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub License GitHub Tag Swift Package Manager Compatible Written in Swift Supported platforms

Pipeline

Custom pipeline operators for easy chaining in Swift

22 ./ Utils.funcThatConvertsIntIntoString ./ { print($0) }

See more examples of usage in unit tests.

Custom Operators

Operator Description
./ Pass through — transform value and continue the chain
.? Pass through unwrapped — unwrap optional, then transform
.+ Mutate — modify value in place via inout
.- Inspect — observe value without modifying it
.* End chain — transform and return final result
.?* End chain unwrapped — unwrap optional, transform, and return
.! Ensure condition — assert a condition or throw
?! Unwrap or throw — unwrap optional or throw an error

Async/Await Support

All operators have async and async throws variants, making them compatible with actors and structured concurrency.

SimpleWrapper & take()

Use take() as an entry point to wrap any value in a SimpleWrapper, which provides:

  • map — transform the wrapped value (sync + async)
  • inspect — observe the value without changing it (sync + async)
  • mutate — modify the value in place (sync + async)

Combine Helpers

Convenience extensions for working with Combine publishers:

  • waitForFirstResult() — await the first published Sendable value
  • observe() — subscribe with simplified callbacks
  • executeNow() — immediately execute and observe
  • ensureMainThread() — receive values on the main thread
  • mutate() — apply mutations via publisher output

Error Types

  • Pipeline.FailedConditionCheck — thrown when a .! condition fails
  • Pipeline.CompletedWithoutValue — thrown when a publisher completes without emitting a value

How to install

XCEPipeline 4 requires Swift 6 or newer. The supported deployment targets remain macOS 12 and iOS 15; platform-independent functionality is also available on Linux.

Install using SwiftPM.

.package(url: "https://github.com/XCEssentials/XCEPipeline.git", from: "4.0.0")

Migrating from 3.x

Version 4 compiles in Swift 6 language mode and therefore requires a Swift 6 toolchain. Publisher.waitForFirstResult() now requires Publisher.Output to conform to Sendable so values can safely cross the async task boundary. The pipeline operators and their behavior are unchanged.

Used by

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.