Swiftpack.co -  bigMOTOR/swift-lens as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
The concept of functional Lenses in Swift
.package(url: "https://github.com/bigMOTOR/swift-lens.git", from: "1.1.0")


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.


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

Example of usage:

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

SPM Install


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


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


Stars: 1
Last commit: 1 week ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

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