spec() { describe("the 'Documentation' directory") { it("has everything you need to get started") { let sections = Directory("Documentation").sections expect(sections).to( contain( "Organized Tests with Quick Examples and Example Groups" ) ) expect(sections).to(contain("Installing Quick")) } context("if it doesn't have what you're looking for") { it("needs to be updated") { let you = You(awesome: true) expect{you.submittedAnIssue}.toEventually(beTruthy()) } } } } }
fileprivate let setter: (A, B) -> A init(getter: @escaping (A) -> B, setter: @escaping (A, B) -> A) { self.getter = getter self.setter = setter } } extension Lens { func get(_ from: A) -> B { return getter(from) } func set(_ from: A, _ to: B) -> A { return setter(from, to) } func modify(_ from: A, f: (B) -> B) -> A { return set(from, f(get(from))) } }