Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jrBordet authored Aug 5, 2020
1 parent 8181079 commit 93189e1
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,37 @@ end
```ruby
pod install
```
## Table of Contents

* [`Optics`](#optics)

## `Optics`
A `Lens` type and a bridge between the lens world and the Swift key path world.

```swift

struct Book: Equatable {
var id: Int
var title: String

var author: Author
}

struct Author: Equatable {
var name: String
var surname: String
}

extension Book {
static var galacticGuideForHitchhikers = Book(id: 2, title: "galactic guide for hitchhikers", author: .adams)
}

extension Author {
static var adams = Author(name: "Adams", surname: "Douglas")
}

let name = .galacticGuideForHitchhikers |> ^\Book.author.name

let newBook = .galacticGuideForHitchhikers |> \Book.author.name *~ "Adams Noël"

```

0 comments on commit 93189e1

Please sign in to comment.