Swiftpack.co - bigMOTOR/swift-lens as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by bigMOTOR.
bigMOTOR/swift-lens 1.1.0
The concept of functional Lenses in Swift
⭐️ 1
🕓 2 years ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/bigMOTOR/swift-lens.git", from: "1.1.0")

swift-lens

The concept of functional Lenses in Swift.

Functional Lens - convenient, powerful, and safe concept for data mutation. A good Talk about Lenses in Swift from Brandon Williams highly recommended.

Operators:

* - lenses composition;
*~ - set value;
|> - piping.

Example of usage:

user = user |> User.idLens *~ newId
user = user |> (User.nameLens * Name.firstNameLens) *~ "Joel"

SPM Install

Contributing

  • Something wrong or you need anything else? Please open an issue or make a Pull Request.
  • Pull requests are welcome.

License

swift-lens is available under the MIT license. See the LICENSE file for more info.

GitHub

link
Stars: 1
Last commit: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

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