Alamofire API Request by RxSwift
pod 'RxCocoa'
pod 'RxSwift'
pod 'Alamofire'
- Download and drop
RRAPIRxManager.swift
in your project. - Add your API end point URL in your project.
- Congratulations!
To run the example project, clone the repo, and run pod install from the Example directory first.
let param = [:]
RRAPIRxManager.rxCall(apiUrl: "API URL", httpMethod: .post, param: param) // Post Request
.flatMap { (response1) -> Observable<Any> in
print(response1)
return RRAPIRxManager.rxCall(apiUrl: "API URL") // Get Request
}
/*.delaySubscription(.seconds(5), scheduler: RXScheduler.concurrentBackground)*/
.subscribeConcurrentBackgroundToMainThreads()
.subscribe(onNext: { response in
print(response)
}, onError: { error in
print(error)
}).disposed(by: rxbag)
We would love you for the contribution to RRAlamofireRxAPI, check the LICENSE
file for more info.
RRAlamofireRxAPI is available under the MIT license. See the LICENSE file for more info.