Following is method provided by RxAlamofire for making requestJSON request there is no method to pass parameters [String : String]
RxAlamofire.requestJSON(.get, url)
.subscribe(onNext: { [weak self] (r, json) in
if let jsonResult = JSON(json) as? JSON {
if let foodMenuResult = MenuResult(jsonResult) as? MenuResult {
self?.delegate?.showMenu(menuResult: foodMenuResult)
}
}
}, onError: { [weak self] (error) in
self?.delegate?.onError()
},onCompleted: {})
.disposed(by: disposeBag)
How to pass parameters to RxAlamofire requestJSON method
You need to construct the
URLfromURLComponents.The
urlabove will beThe use of
!should not be problematic above as the data you are passing should be valid. Please refer to the documentation of these methods though to assess the requirement for propernilhandling.