Created
June 3, 2017 17:24
-
-
Save sergdort/54cc33d5eb389ff766db75484fa104b9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Observable<Element>: ObservableType { | |
public typealias E = Element | |
private let _subscribeHandler: (Observer<Element>) -> Disposable | |
public init(_ subscribtionClosure: @escaping (Observer<Element>) -> Disposable) { | |
_subscribeHandler = subscribtionClosure | |
} | |
public func subscribe<O : ObserverType>(observer: O) -> Disposable where O.E == E { | |
let sink = Sink(forvard: observer, subscribtionHandler: _subscribeHandler) | |
sink.run() | |
return sink | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment