As an open-source project, RxSwiftCommunity/RxAlamofire has picked up 1.6k stars on GitHub (Swift). RxSwift wrapper around the elegant HTTP networking in Swift Alamofire
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
RxAlamofire is a RxSwift wrapper around the elegant HTTP networking in Swift Alamofire.
Getting Started
Wrapping RxSwift around Alamofire makes working with network requests a smoother and nicer task. Alamofire is a very powerful framework and RxSwift add the ability to compose responses in a simple and effective way.
A basic usage is (considering a simple currency converter):
let formatter = NSNumberFormatter()
formatter.numberStyle = .currencyStyle
formatter.currencyCode = "USD"
if let fromValue = NSNumberFormatter().numberFromString(self.fromTextField.text!) {
RxAlamofire.requestJSON(.get, sourceStringURL)
.debug()
.subscribe(onNext: { [weak self] (r, json) in
if let dict = json as? [String: AnyObject] {
let valDict = dict["rates"] as! Dictionary<String, AnyObject>
if let conversionRate = valDict["USD"] as? Float {
self?.toTextField.text = formatter
.string(from: NSNumber(value: conversionRate * fromValue))
}
}
}, onError: { [weak self] (error) in
self?.displayError(error as NSError)
})
.disposed(by: disposeBag)
} else {
self.toTextField.text = "Invalid Input!"
}
Example Usages
Currently, the library features the following extensions:
let stringURL = ""
// MARK: URLSession simple and fast
let session = URLSession.shared()
_ = session.rx
.response(.get, stringURL)
.observeOn(MainScheduler.instance)
.subscribe { print($0) }
_ = session.rx
.json(.get, stringURL)
.observeOn(MainScheduler.instance)
.subscribe { print($0) }
_ = session.rx
.data(.get, stringURL)
.observeOn(MainScheduler.instance)
.subscribe { print($0) }
// MARK: With Alamofire engine
_ = json(.get, stringURL)
.observeOn(MainScheduler.instance)
.subscribe { print($0) }
// validation
_ = request(.get, stringURL)
.validate(statusCode: 200..<300)
.validate(contentType: ["application/json"])
.responseJSON()
.observeOn(MainScheduler.instance)
.subscribe { print($0) }
// progress
_ = request(.get, stringURL)
.progress()
.observeOn(MainScheduler.instance)
.subscribe { print($0) }
// just fire upload and display progress
_ = upload(Data(), urlRequest: try! RxAlamofire.urlRequest(.get, stringURL))
.progress()
.observeOn(MainScheduler.instance)
.subscribe { print($0) }
// progress and final result
// uploading files with progress showing is processing intensive operation anyway, so
// this doesn't add much overhead
_ = request(.get, stringURL)
.flatMap { request -> Observable<(Data?, RxProgress)> in
let dataPart = request.rx
.data()
.map { d -> Data? in d }
.startWith(nil as Data?)
let progressPart = request.rx.progress()
return Observable.combineLatest(dataPart, progressPart) { ($0, $1) }
}
.observeOn(MainScheduler.instance)
.subscribe { print($0) }
// MARK: Alamofire Session
// same methods with any Alamofire Session
let session = Session.default
// simple case
_ = session.rx.json(.get, stringURL)
.observeOn(MainScheduler.instance)
.subscribe { print($0) }
// URLHTTPResponse + JSON
_ = session.rx.responseJSON(.get, stringURL)
.observeOn(MainScheduler.instance)
.subscribe { print($0) }
// URLHTTPResponse + String
_ = session.rx.responseString(.get, stringURL)
.observeOn(MainScheduler.instance)
.subscribe { print($0) }
// URLHTTPResponse + Validation + JSON
_ = session.rx.request(.get, stringURL)
.validate(statusCode: 200 ..< 300)
.validate(contentType: ["text/json"])
.json()
.observeOn(MainScheduler.instance)
.subscribe { print($0) }
// URLHTTPResponse + Validation + URLHTTPResponse + JSON
_ = session.rx.request(.get, stringURL)
.validate(statusCode: 200 ..< 300)
.validate(contentType: ["text/json"])
.responseJSON()
.observeOn(MainScheduler.instance)
.subscribe { print($0) }
// URLHTTPResponse + Validation + URLHTTPResponse + String + Progress
_ = session.rx.request(.get, stringURL)
.validate(statusCode: 200 ..< 300)
.validate(contentType: ["text/something"])
.flatMap { request -> Observable<(String?, RxProgress)> in
let stringPart = request.rx
.string()
.map { d -> String? in d }
.startWith(nil as String?)
let progressPart = request.rx.progress()
return Observable.combineLatest(stringPart, progressPart) { ($0, $1) }
}
.observeOn(MainScheduler.instance)
.subscribe { print($0) }
// Interceptor + URLHTTPResponse + Validation + JSON
let adapter = // Some RequestAdapter
let retrier = // Some RequestRetrier
let interceptor = Interceptor(adapter: adapter, retrier: retrier)
_ = session.rx.request(.get, stringURL)
.validate()
.validate(contentType: ["text/json"])
.responseJSON()
.observeOn(MainScheduler.instance)
.subscribe { print($0) }
How active is development on RxSwiftCommunity/RxAlamofire?
The most recent commit recorded on RxSwiftCommunity/RxAlamofire was 2.6 years ago, based on the GitHub push timestamp. The repository has 242 forks — one of the better signals of community interest.
How many stars does RxSwiftCommunity/RxAlamofire have?
RxSwiftCommunity/RxAlamofire has 1.6k GitHub stars — refresh the page for the live number, or check github.com/RxSwiftCommunity/RxAlamofire. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
Is RxSwiftCommunity/RxAlamofire open source?
Yes — RxSwiftCommunity/RxAlamofire ships under the MIT license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/RxSwiftCommunity/RxAlamofire.
What is RxSwiftCommunity/RxAlamofire?
RxSwiftCommunity/RxAlamofire (RxSwiftCommunity/RxAlamofire) is a Swift project on GitHub. From the project's own README: RxSwift wrapper around the elegant HTTP networking in Swift Alamofire
What language is RxSwiftCommunity/RxAlamofire written in?
RxSwiftCommunity/RxAlamofire is written primarily in Swift. GitHub's language field is based on the largest share of bytes in the default branch.
What license does RxSwiftCommunity/RxAlamofire use?
RxSwiftCommunity/RxAlamofire is released under the MIT license. Always verify the LICENSE file directly on GitHub for the authoritative terms — license strings can be edited out of sync with a project's actual stance.
Where do I read more about RxSwiftCommunity/RxAlamofire?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/RxSwiftCommunity/RxAlamofire is the definitive source.
Read full README in the tab above.
Want a second opinion on RxAlamofire?
Ask an AI that can read this page — one click and you get its take on RxAlamofire.