Skip to content

Instantly share code, notes, and snippets.

@nomothetis
Created March 23, 2015 20:37
Show Gist options
  • Save nomothetis/247e9dd0a72e264bf78b to your computer and use it in GitHub Desktop.
Save nomothetis/247e9dd0a72e264bf78b to your computer and use it in GitHub Desktop.
func loginProducer(username:String, password:String) -> SignalProducer<UserState, LoginError> {
return SignalProducer { sink, disposable in
Alamofire.DO_ALAMOFIRE_THINGS { data, response, error in
// do error checking and nil checking and send errors.
// if all is good, send next and complete.
}
} |> tryMap(validateServerError) |> tryMap(validateLogin) |> tryMap(parseLogin)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment