Skip to content

Instantly share code, notes, and snippets.

@mbalex99
mbalex99 / gist:8802db1695f20c520ca0
Last active Jan 29, 2020
Alamofire and RxSwift
View gist:8802db1695f20c520ca0
let rx_request = Observable<Value>.create { (observer) -> Disposable in
let requestReference = Alamofire.request(.POST, url, parameters: payload)
.responseJSON(completionHandler: { (response) in
if let value = response.result.value {
observer.onNext(value)
observer.onCompleted()
}else if let error = response.result.error {
observer.onError(error)
}
})