RxAlamofire cannot be used with URLRequest
I am using RxAlamofire
to create observable
. I have built URLRequest
. usually with Alamofire
we can use like Alamofire.request(urlRequest)
, but it seems like with RxAlamofire
I cannot useRxAlamofire.requet(urlRequest)
Here is my function
func createOrUpdateItem(for id: NSNumber) -> Observable<Item> {
let testRequest = Router.top.urlRequest
let test = RxAlamofire.request(testRequest)
}
Here is the error
It looks like it RxAlamofire
only accepts the parameter URL
and URLConvertible
. It is strange that I browse RxAlamofire, there are 2 methods that take both URLConvertible
, and so URLRequestConvertible
. Anyone have the same problem and how to solve it? I am asking this because my application is using Alamofire Router
, which is an enumeration accepted in URLRequestConvertible
Many Thanks. Hope I can make my question clear.
/**
Creates an observable of the `Request`.
- parameter method: Alamofire method object
- parameter url: An object adopting `URLConvertible`
- parameter parameters: A dictionary containing all necessary options
- parameter encoding: The kind of encoding used to process parameters
- parameter header: A dictionary containing all the addional headers
- returns: An observable of the `Request`
*/
public func request(_ method: Alamofire.HTTPMethod, _ url: URLConvertible, parameters: [String : Any]? = default, encoding: ParameterEncoding = default, headers: [String : String]? = default) -> RxSwift.Observable<Alamofire.DataRequest>
/**
Creates an observable of the `Request`.
- parameter URLRequest: An object adopting `URLRequestConvertible`
- parameter parameters: A dictionary containing all necessary options
- parameter encoding: The kind of encoding used to process parameters
- parameter header: A dictionary containing all the addional headers
- returns: An observable of the `Request`
*/
public func request(urlRequest: URLRequestConvertible) -> RxSwift.Observable<Alamofire.DataRequest>
No one has answered this question yet
Check out similar questions: