SMNetworkManager was build on the top of Alamofire to handle API calls easily. By SMNetworkManager
allows to send request and get reponse as codable
models.
- Send request as
Codable
- Get response as
Codable model
- Custom error dialoges for bad requests
- Native JSON encoding and decoding procress.
SMNetworkManager is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'SMNetworkManager'
//setting headers for network calls
SMNetworkManager.headers = [:]
let request = RequestModel() ///Codable
//In viewController
self.fetch(url: "https://someAPI", request: request, responseType: ResponseModel.self) { [weak self] (response) in
print(response)
})
HTTP Method
//default = .get
method:HTTPMethod
URL Encoding
//default = .get
urlEncoding:URLEncoding
Example:
self.fetch(url: API, method: .post, paramEncoding: .default, request: requestModel(), responseType: ReponseModel.self) { (responseModel) in
print(responseModel)
}
⚙️ In Development
🙍🏻♂️ Suresh Mopidevi
SMNetworkManager is available under the MIT license. See the LICENSE file for more info.