RMHttp
Lightweight REST library for iOS and watchOS. Available on cococapods
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
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:
Installation
Run the following command in your Terminal
Usage
HTPP 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>
JSONArray
- a representation of [Dictionary<String, Any>]
String
Any String respresentation (e.g HTML String, XML String, Plain Text)
Building Request
Building request with parameters from Dictionary type
Building request with parameters from RMParams
container
URL query representation names[]=lorem&names[]=ipsum&names[]=dolor&
Chained Response Handlers
Expecting Array object Response
Expecting JSON object Response
Generic method that return HTTP response has parameter data
that comply to RMHttpProtocol
(e.g JSONObject, JSONArray, String, )
FORM-DATA
Add fields from dictionary type
Add file
See Media Types
Or manually add field
Author
rogermolas, contact@rogermolas.com