Skip to content

AlexyIbrahim/AINetworkCalls

Repository files navigation

AINetworkCalls

Swift Version License Platform

A Network calls helper library that depends on Alamofire and SwiftyJSON to provide an easy to use way to call your APIs

Requirements

  • iOS 12.0+
  • Xcode 10.0+

Installation

Swift Package Manager

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")

Usage example

Add this anywhere in your application

extension AIEndpoint {
    public static let endpointName = AIEndpoint(rawValue: "https://endpointValue/")
}

Code:

Callback

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))")
}

Rx

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)

Meta

Alexy Ibrahim – @Github[email protected]

See LICENSE for more information.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published