RMHttp alternatives and similar libraries
Based on the "Networking" category.
Alternatively, view RMHttp alternatives based on common mentions on social networks and blogs.
-
RealReachability
We need to observe the REAL reachability of network. That's what RealReachability do. -
Networking
DISCONTINUED. Easy HTTP Networking in Swift a NSURLSession wrapper with image caching support -
XMNetworking
A lightweight but powerful network library with simplified and expressive syntax based on AFNetworking. -
Digger
Digger is a lightweight download framework that requires only one line of code to complete the file download task -
SOAPEngine
This generic SOAP client allows you to access web services using a your iOS app, Mac OS X app and AppleTV app. -
TWRDownloadManager
A modern download manager based on NSURLSession to deal with asynchronous downloading, management and persistence of multiple files. -
ws โ๏ธ
โ ๏ธ Deprecated - (in favour of Networking) :cloud: Elegantly connect to a JSON api. (Alamofire + Promises + JSON Parsing) -
MultiPeer
๐ฑ๐ฒ A wrapper for the MultipeerConnectivity framework for automatic offline data transmission between devices -
AFNetworking+RetryPolicy
Nice category that adds the ability to set the retry interval, retry count and progressiveness.
CodeRabbit: AI Code Reviews for Developers

* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of RMHttp or a related project?
README
RMHttp
RMHttp is a Lightweight REST library for iOS and watchOS.
Features
- [x] Chainable Request
- [x] URL / JSON Parameter Encoding
- [x] HTTP Methods GET/POST/DELETE/PATCH/PUT based in RFC2616
- [x] Custom Request Builder / HEADERS / PARAMETERS
- [x] Form-Data Support
- [x] Dynamic Response Handler (JSONObject, JSONArray, String)
- [x] Codable Support
- [x] Support Parameters Container
RMParams
TODO:
- [-] Support Upload/Download resource
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
Installation
RMHttp is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'RMHttp'
Installation
pod "RMHttp"
Run the following command in your Terminal
$ pod install
Usage
HTTP Methods
HTTP Methods are declared in public enum RMHttpMethod
.
GET
, POST
, DELETE
, PUT
, PATCH
Parameter Encoding
Encoding are declared in public enum Encoding
URLEncoding
JSONEncoding
Serialization
JSONObject
- a representation of Dictionary<String, Any>
{
"data" : "value",
"isBoolean" : true,
"list": [
"object1",
"object2"
]
}
JSONArray
- a representation of [Dictionary<String, Any>]
[
{ "data1" : "value1"},
{ "data2" : "value2"},
{ "data3" : "value3"},
]
String
Any String respresentation (e.g HTML String, XML String, Plain Text)
Building Request
Building request with parameters from Dictionary type
let params = [
"string":"Ipsum", // String
"number": 100, // Number
"boolean":true // Boolean
] as [String : Any]
let urlString = "https://httpbin.org/get"
let request = RMRequest(urlString, method: .GET(.URLEncoding), parameters: params, hearders: nil)
Building request with parameters from RMParams
container
URL query representation names[]=lorem&names[]=ipsum&names[]=dolor&
let lorem = RMParams(key: "names[]", value: "lorem")
let ipsum = RMParams(key: "names[]", value: "ipsum")
let dolor = RMParams(key: "names[]", value: "dolor")
let params = [lorem, ipsum, dolor]
let urlString = "https://httpbin.org/post"
request = RMRequest(urlString, .GET(.URLEncoding), params, nil)
return request
Chained Response Handlers
Expecting Array object Response
RMHttp.JSON(request: request) { (response:JSONArray?, error) in
guard error == nil else {
self.title = "Response Error"
self.activity.stopAnimating()
self.textView.text = "\(err)"
return
}
self.activity.stopAnimating()
if let data = response {
self.title = "Response Sucess"
self.textView.text = "\(data)"
}
}
Expecting JSON object Response
RMHttp.JSON(request: request) { (response:JSONObject?, error) in
guard error == nil else {
self.title = "Response Error"
self.activity.stopAnimating()
self.textView.text = "\(err)"
return
}
self.activity.stopAnimating()
if let data = response {
self.title = "Response Sucess"
self.textView.text = "\(data)"
}
}
Generic method that return HTTP response has parameter data
that comply to RMHttpProtocol
(e.g JSONObject, JSONArray, String, )
public class func JSON<T:RMHttpProtocol>(request: RMRequest, completionHandler: @escaping Handler<T>)
FORM-DATA
Add fields from dictionary type
let params = [
"name":"lorem",
"lastName":"ipsum"
]
let urlString = "https://httpbin.org/post"
let request = RMRequest(urlString, .POST(.FomDataEncoding), params, nil)
return request
Add file
See Media Types
let request = RMRequest(url: URL(string: urlString)!)
request.addForm(field: "file", file: imgData, fileName: "image.jpeg", mimeType: "image/jpeg")
request.setHttp(method: .POST(.FomDataEncoding))
return request
Or manually add field
let request = RMRequest(url: URL(string: urlString)!)
request.addForm(fieldName: "field1", value: "lorem ipsum")
request.addForm(fieldName: "field2", value: "sit dolor amet")
Author
rogermolas, [email protected]
License
The MIT License (MIT)
Copyright (c) 2018-2020 Roger Molas
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*Note that all licence references and agreements mentioned in the RMHttp README section above
are relevant to that project's source code only.