Created
June 5, 2019 13:33
-
-
Save hermanbanken/b9d07a984fc8cc34943803e98787d286 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| extension Observable : Publisher { | |
| @available(iOS 13.0, *) | |
| public func receive<S>(subscriber: S) where S : Subscriber, Observable.Failure == S.Failure, Observable.Output == S.Input { | |
| _ = self.subscribe(onNext: { (next) in | |
| let demand = subscriber.receive(next) | |
| }, onError: { (err) in | |
| subscriber.receive(completion: .failure(err)) | |
| }, onCompleted: { | |
| subscriber.receive(completion: .finished) | |
| }) | |
| } | |
| public typealias Failure = Error | |
| public typealias Output = Element | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment