A Network calls helper library that depends on Alamofire and SwiftyJSON to provide an easy to use way to call your APIs
- iOS 12.0+
- Xcode 10.0+
You can use SPM to install AINetworkCalls
by adding it to your Package.swift
:
.package(url: "https://github.com/AlexyIbrahim/AINetworkCalls.git", from: "1.2.4")
Add this anywhere in your application
extension AIEndpoint {
public static let endpointName = AIEndpoint(rawValue: "https://endpointValue/")
}
Code:
AINetworkCalls.get(endpoint: .endpointName, function: "get", headers: nil, encoding: .default, parameters: parameters, displayWarnings: true, successCallback: { (response: JSON) in
print("json response: \(String(describing: response))")
}) { (json, error) in
print("error json: \(String(describing: json))")
}
AINetworkCalls.rxGet(endpoint: .endpointName, function: "get", headers: nil, encoding: .default, parameters: parameters, displayWarnings: true).subscribe(onSuccess: { (response: JSON) in
print("rxGet json response: \(String(describing: response))")
}) { (error) in
print("rxGet error: \(String(describing: error))")
}.disposed(by: disposeBag)
Alexy Ibrahim – @Github – [email protected]
See LICENSE
for more information.