Elegant net abstraction layer written in Swift 4.0, we provide an integration with Alamofire.
- iOS 10.0+
- Swift 4.0+
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapodsCocoaPods 1.1+ is required to build PocketNet 1.0.0
To integrate PocketNet into your Xcode project using CocoaPods, specify it in your Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!
target '<Your Target Name>' do
pod 'PocketNet', '~> 1.0.0'
endThen, run the following command:
$ pod installimport PocketNet
let net: PocketNet = PocketNetAlamofire()
let netSupport = NetSupport(net: net)
let request = NetRequest.Builder()
.method(.post)
.url("url")
.requestHeader([:])
.parameterEncoding(.json)
.body(params: "")
.shouldCache(false)
.build()
netSupport.netJsonMappableRequest(request, completion: {(result: Result<ConvertibleObject, Error>) in
switch result {
case .success(let convertibleObject):
/// do something with convertibleObject
case .failure(let error):
/// do something with error
}
})Net is available under the MIT license. See the LICENSE file for more info.
