Pipeline

1.1

A lightweight pipeline system for Swift.
m1guelpf/swift-pipeline

What's New

Add AsyncPipeline

2025-02-03T11:11:05Z

Full Changelog: v1.0...v1.1

Pipeline for Swift

Swift Version GitHub license

A convenient way to "pipe" a given input through a series of invokable classes, closures, or callables, giving each class the opportunity to inspect or modify the input and invoke the next callable in the pipeline.

Installation

Swift Package Manager

The Swift Package Manager allows for developers to easily integrate packages into their Xcode projects and packages and is also fully integrated into the swift compiler.

SPM Through XCode Project

SPM Through Xcode Package

Once you have your Swift package set up, add the Git link within the dependencies value of your Package.swift file.

dependencies: [
    .package(url: "https://github.com/m1guelpf/swift-pipeline.git", .branch("main"))
]

Usage

To get started, create a new pipeline with the send method, passing the input you want to pipe through the pipeline. Then, use the through method to add a series of pipes (either classes implenting the Pipe protocol, or closures) to the pipeline. Finally, call the then method to transform and get the final output.

You can also append Pipes to an existing pipeline using the pipe method, or use thenReturn to get the final output without transforming it.

import Pipeline;

try Pipeline.send(project).through(
    .pipe(BuildProject(),
    .pipe(UploadProject(),
    .pipe(DeployProject()),
    .fn { project in
        // ...

        return project
    }
))).run()

If you need to run asyncronous operations, use AsyncPipeline instead.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Description

  • Swift Tools 6.0.0
View More Packages from this Author

Dependencies

  • None
Last updated: Fri May 16 2025 06:30:30 GMT-0900 (Hawaii-Aleutian Daylight Time)