Latest1.6.1
Homepagehttps://github.com/PocketSwift/PocketNet
LicenseMIT
Platformsios 8.0, requires ARC
Authors

PocketNet

CocoaPods Compatible
License

PocketNet

Elegant net abstraction layer written in Swift 4.1, we provide an integration with Alamofire.

Requirements

  • iOS 8.0+

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

CocoaPods 1.1+ is required to build PocketNet 1.6.1

To integrate PocketNet into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'PocketNet'
end

Then, run the following command:

$ pod install

Usage

import PocketNet

let net: PocketNet = PocketNetAlamofire() /*or for SSL Pinning*/ PocketNetAlamofire(pinningSSLCertURL: Bundle.main.url(forResource: "cert", withExtension: "crt"), domain: "urlDomain")

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<DecodableObject, Error>) in
    switch result {
    case .success(let decodableObject):
        /// do something with decodableObject
    case .failure(let error):
        /// do something with error
    }
})

netSupport.netArrayJsonMappableRequest(request, completion: {(result: Result<[DecodableObject], Error>) in
    switch result {
    case .success(let decodableObject):
        /// do something with decodableObject
    case .failure(let error):
        /// do something with error
    }
})

Authors

Special thanks

Libraries used in this project

License

Net is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "PocketNet",
    "version": "1.6.1",
    "homepage": "https://github.com/PocketSwift/PocketNet",
    "summary": "Net with Alamofire implementation",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "PocketSwift": "https://github.com/PocketSwift"
    },
    "source": {
        "git": "https://github.com/PocketSwift/PocketNet.git",
        "tag": "1.6.1"
    },
    "static_framework": true,
    "swift_version": "4.1",
    "source_files": [
        "Classes",
        "PocketNet/**/*.swift",
        "StaticPods/**/*.swift"
    ],
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true
}

Pin It on Pinterest

Share This