Skip to content
This repository has been archived by the owner on Oct 14, 2021. It is now read-only.

Commit

Permalink
Set next in the ValueObserver wrather than wrap it.
Browse files Browse the repository at this point in the history
Reviewers: O4 Material Motion Apple platform reviewers, O2 Material Motion, markwei

Reviewed By: O4 Material Motion Apple platform reviewers, O2 Material Motion, markwei

Tags: #material_motion

Differential Revision: http://codereview.cc/D2121
  • Loading branch information
Jeff Verkoeyen committed Dec 6, 2016
1 parent fd5869d commit ec6d4b1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
10 changes: 3 additions & 7 deletions src/IndefiniteObservable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,11 @@ public let noopUnsubscription: (() -> Void)? = nil
public final class ValueObserver<T> {
public typealias Value = T

init(_ next: @escaping (Value) -> Void) {
_next = next
public init(_ next: @escaping (T) -> Void) {
self.next = next
}

public func next(_ value: Value) {
_next(value)
}

private let _next: (Value) -> Void
public let next: (T) -> Void
}

// MARK: Private
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/ObservableTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ class ObservableTests: XCTestCase {
func testFilteringValues() {
let value = CGPoint(x: 0, y: 10)
let observable = IndefiniteObservable<(Bool, CGPoint)> { observer in
observer.next((false, value))
observer.next((true, value))
observer.next(false, value)
observer.next(true, value)
return noopUnsubscription
}

Expand Down

0 comments on commit ec6d4b1

Please sign in to comment.