Created
June 2, 2017 21:01
-
-
Save sergdort/c23c5f21f9468fc1ef16b6b1775988cc 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