Swiftpack.co - ddddxxx/Pipeline as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by ddddxxx.
ddddxxx/Pipeline v0.2.0
Syntactic sugar for Swift optional chaining.
⭐️ 2
🕓 3 years ago
.package(url: "https://github.com/ddddxxx/Pipeline.git", from: "v0.2.0")

Pipeline

Reverse function application with optional chaining support.

Quick Look

let attributedString = fileURLString
    |> URL.init(fileURLWithPath:)
    |> { try! Data(contentsOf: $0) }
    ?> UIImage.init(data:)
    ?> NSTextAttachment.init(image:)
    ?> NSAttributedString.init(attachment:)

is equivalent to:

if let image = UIImage(data: try! Data(contentsOf: URL(fileURLWithPath: fileURLString))),
    let attachment = NSTextAttachment(image: image) {
    let attributedString = NSAttributedString(attachment: attachment)
    // use attributedString here
}

Installation

Swift Package Manager

Add the project to your Package.swift file:

package.dependencies += [
    .package(url: "https://github.com/ddddxxx/Pipeline", from: "0.2.0"),
]

License

Pipeline is available under the MIT license. See the LICENSE file.

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