Questions tagged [rxalamofire]

44 questions
5
votes
1 answer

RxAlamofire - how to get the response on error?

I need the response body when an error occurs in an RxAlamofire call. I've seen this hack but I wonder if there's a cleaner way. Inspired by it, I created this RxAlamofire fork with a similar hack. With it, errors will usually be an instance of…
Ferran Maylinch
  • 9,556
  • 13
  • 70
  • 89
4
votes
0 answers

RxAlamofire cannot use with URLRequest

I'm using RxAlamofire to create my observable. I have build the URLRequest. normally with Alamofire we can use like Alamofire.request(urlRequest) but seem with RxAlamofire I can not use RxAlamofire.requet(urlRequest) Here is my function func…
Lê Khánh Vinh
  • 2,329
  • 4
  • 24
  • 63
3
votes
2 answers

Periodically call an API with RxSwift

I'm trying to periodically (every 10 seconds) call an API that returns a Json object of model : struct MyModel { var messagesCount: Int? var likesCount: Int? } And update the UI if messageCount or likesCount value changes. I tried the Timer…
Dr34m3r
  • 43
  • 1
  • 3
3
votes
2 answers

How to cancel previous request using RxAlamofire?

I want to cancel the previous request using RxAlamofire. But I don't know where to call the cancel function. I have a searchBar, and I call the API in function "textdidchange". So, I want to cancel the previous request and call the API with new…
JimmyLee
  • 397
  • 5
  • 17
3
votes
0 answers

Uploading file with parameters using RxAlamofire

I have an array of images. let images:[UIImage] I want to upload images to the server, after uploading each image I will get the URL of the image as a response. How to organize a uploading chain(loop) and get all responses using RxAlamofire? P.S.…
Igor Kasuan
  • 652
  • 2
  • 8
  • 23
2
votes
1 answer

Using RxAlamofire to create Observable contain the result of network request

I'm trying to work with RxAlamofire to wrap a network request result. My objective is to fire request, handle JSON response and create and Observable that contain either network operation success or any error occur. In other place I can call the…
Lê Khánh Vinh
  • 2,329
  • 4
  • 24
  • 63
2
votes
1 answer

RxAlamofire post multipart data

How to send Multipart data with RxAlamofire For instance in Alamofire let URL = try! URLRequest(url: "http://example.com", method: .post) Alamofire.upload(multipartFormData: { formData in // multiaprt }, with: URL, encodingCompletion:…
harsh_v
  • 2,833
  • 2
  • 27
  • 46
1
vote
1 answer

How to check if same DataRequest is already in progress using RxAlamofire or Alamofire 5 and up?

My workflow is simple. I don't need to make the same DataRequest 2 times and need to check wether this request is already in progress. If request is not in progress I need to make the request if some specific time has passed. How could I achieve…
Serban S
  • 95
  • 7
1
vote
1 answer

Removing Swift RxAlamofire dependency

I'm trying to remove my dependency on RxAlamofire. I currently have this function: func requestData(_ urlRequest: URLRequestConvertible) -> Observable<(HTTPURLResponse, Data)> { RxAlamofire.request(urlRequest).responseData() } How can I…
Brandt
  • 313
  • 1
  • 10
1
vote
1 answer

RxAlamofire extension to hanlde error at one place

Following is my code to do RxAlamofire requests RxAlamofire.request(request as URLRequestConvertible).validate(statusCode: 200..<300).responseJSON().asObservable() .subscribe(onNext: { [weak self] (response) in if let json =…
amodkanthe
  • 4,119
  • 4
  • 27
  • 55
1
vote
0 answers

Swift compile error - Could not build Objective-C module 'RxAlamofire'

I am using Swift 4.2 and Xcode 10.1 And while importing RxAlamofire to my project I am getting an error "Could not build Objective-C module 'RxAlamofire' ". I have tried to clean the build folder and build it again. And also delete the Derived data…
1
vote
1 answer

How to download image using RxAlamofire

func showImageForUrl(url: String) -> Observable> { let result = RxAlamofire .requestJSON(.get, url, parameters: nil) .flatMap { (response, json) -> Observable in …
user1898829
  • 3,047
  • 6
  • 28
  • 51
1
vote
1 answer

How to make Post call using RxAlamofire pass json in post body

I want to make a post call using RxAlamofire it provides function requestJson which requires two parameters type get or post and url but there is no parameter to pass post json body how to do that following is my code var components =…
amodkanthe
  • 4,119
  • 4
  • 27
  • 55
1
vote
2 answers

Error in closure tuple parameter

I'm trying to write an API layer using RxSwift and RxAlamofire. Here is the code for API request. public func _request(_ method: Alamofire.HTTPMethod, url: URLConvertible, parameters: [String : Any]? , encoding: ParameterEncoding, headers: [String…
Vinod Radhakrishnan
  • 391
  • 1
  • 4
  • 18
1
vote
1 answer

RxAlamofire - event on download completed missing

I'm using RxAlamofire for downloading file. I have something like this: let downloadResult = download(request, to: destination) Unfortunately downloadResult observable doesn't emit next event on download completed, it only emits onCompleted. I…
Wujo
  • 1,501
  • 2
  • 19
  • 31
1
2 3