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"
swift-lens is available under the MIT license. See the LICENSE file for more info.
link |
Stars: 1 |
Last commit: 2 years ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics