ACMNetworking is a network library that help developers to make requests easily.
Via Cocoapods
pod 'ACMNetworking'
Via SPM, add new package, search url below
https://github.com/AppcentMobile/ACMNetworking
- Create plist file called ACMConfig
- Add these keys
baseURL (String)(without http(s))
isLogEnabled (Bool)
timeout (Number)
- Build a request via builder
let endpoint = ACMEndpoint()
.set(method: .get)
.set(path: BAPathModel(path: "products", value: id))
.add(header: BAHeaderModel(field: "fieldOne", value: "valueOne"))
.add(header: BAHeaderModel(field: "fieldTwo", value: "valueTwo"))
.add(queryItem: BAQueryModel(name: "nameOne", value: "valueOne"))
.add(queryItem: BAQueryModel(name: "nameTwo", value: "valueTwo"))
.build()
- Make request!
network.request(to: endpoint) { (response: ProductResponse) in
print(response)
} onProgress: { model in {
print(model.formattedPercentage())
} onError: { error in
print(error)
}
https://github.com/AppcentMobile/ACMNetworkingSample
https://acmnetworking-fbacf.web.app
- Apache License 2.0 (LICENCE-Apache-2.0 or https://opensource.org/license/apache-2-0/)