Skip to content

ddddxxx/Pipeline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

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.

About

Syntactic sugar for Swift optional chaining.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages