I hereby claim:
- I am alessandro-martin on github.
- I am alessandromartin (https://keybase.io/alessandromartin) on keybase.
- I have a public key ASBw8TbA9KyorMe8iR06bmLiK5mj3Btabhno_jmZVmt7oQo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| import Foundation | |
| // A lens is a getter and a setter combined | |
| struct Lens<Whole, Part> { | |
| let get: (Whole) -> Part | |
| let set: (inout Whole, Part) -> () | |
| } | |
| // We can create a lens from a key path | |
| extension Lens { |
| // Up until Xcode 8.3.2 | |
| // switching over a type's static properties required full namespace qualification | |
| // This wouldn't compile | |
| // Fixed in Xcode 9 :D | |
| extension String { | |
| static let firstSection: String = "firstSection" | |
| static let secondSection: String = "secondSection" | |
| } |