Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Wrapped Asynchronous Function with ReactiveSwift
// Wrapping Asynchronous Function
func wrappedFunction() -> SignalProducer<String, MockError> {
return SignalProducer { observer, disposable in
mockAsyncFunction { (optionalReturnedString, optionalReturnedError) in
if let returnedString = optionalReturnedString {
observer.send(value: returnedString)
} else if let returnedError = optionalReturnedError {
observer.send(error: returnedError)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment