-
-
Save vincent-pradeilles/217aa21db7e466073d3927b7f2d8245e 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
func fromAsync<T>(_ asyncRequest: @escaping ( @escaping (T) -> Void) -> Void) -> Observable<T> { | |
return Observable.create({ (o) -> Disposable in | |
asyncRequest({ (result) in | |
o.onNext(result) | |
o.onCompleted() | |
}) | |
return Disposables.create() | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment