diff --git a/RxCocoa/Common/Observables/Implementations/KVOObservable.swift b/RxCocoa/Common/Observables/Implementations/KVOObservable.swift index 06577002..c5a0bac2 100644 --- a/RxCocoa/Common/Observables/Implementations/KVOObservable.swift +++ b/RxCocoa/Common/Observables/Implementations/KVOObservable.swift @@ -11,8 +11,11 @@ import Foundation import RxSwift #endif -class KVOObservable : _Producer - , KVOObservableProtocol { +class KVOObservable + : ObservableType + , KVOObservableProtocol { + typealias E = Element? + unowned var target: AnyObject var strongTarget: AnyObject? @@ -30,7 +33,7 @@ class KVOObservable : _Producer } } - override func run(observer: O, cancel: Disposable, setSink: (Disposable) -> Void) -> Disposable { + func subscribe(observer: O) -> Disposable { let observer = KVOObserver(parent: self) { (value) in if value as? NSNull != nil { observer.on(.Next(nil)) diff --git a/RxCocoa/Common/Observables/NSObject+Rx.swift b/RxCocoa/Common/Observables/NSObject+Rx.swift index d61992c6..4f3acd33 100644 --- a/RxCocoa/Common/Observables/NSObject+Rx.swift +++ b/RxCocoa/Common/Observables/NSObject+Rx.swift @@ -59,7 +59,7 @@ extension NSObject { - returns: Observable sequence of objects on `keyPath`. */ public func rx_observe(keyPath: String, options: NSKeyValueObservingOptions = [.New, .Initial], retainSelf: Bool = true) -> Observable { - return KVOObservable(object: self, keyPath: keyPath, options: options, retainTarget: retainSelf) + return KVOObservable(object: self, keyPath: keyPath, options: options, retainTarget: retainSelf).asObservable() } } diff --git a/RxSwift/Observables/Implementations/Producer.swift b/RxSwift/Observables/Implementations/Producer.swift index c1d32a08..63c38c76 100644 --- a/RxSwift/Observables/Implementations/Producer.swift +++ b/RxSwift/Observables/Implementations/Producer.swift @@ -8,18 +8,12 @@ import Foundation -public class _Producer : Producer { - public override init() { - super.init() - } -} - -public class Producer : Observable { +class Producer : Observable { override init() { super.init() } - public override func subscribe(observer: O) -> Disposable { + override func subscribe(observer: O) -> Disposable { let sink = SingleAssignmentDisposable() let subscription = SingleAssignmentDisposable() @@ -43,7 +37,7 @@ public class Producer : Observable { return d } - public func run(observer: O, cancel: Disposable, setSink: (Disposable) -> Void) -> Disposable { + func run(observer: O, cancel: Disposable, setSink: (Disposable) -> Void) -> Disposable { abstractMethod() } } \ No newline at end of file