Latest 1.1.0
Homepage https://github.com/DragonCherry/NetworkRequester
License MIT
Platforms ios 8.0
Dependencies TinyLog, Alamofire, SwiftyJSON
Authors

Simple and customizable network library to use in iOS application project.

Example

// Place common network configuration like below,
class CustomNetworkRequester: NetworkRequester {
    override func customize() {
        add(header: "CommonValue", forKey: "Common-Key")
        set(timeout: 5)
        set(encoding: JSONEncoding.default)
        set(user: "USER_ID", password: "USER_PASSWORD")
    }
}

// Call anywhere you if need response by SwiftyJSON object
CustomNetworkRequester(.post, urlString: "https://httpbin.org/post")
    .add(header: "HeaderValue", forKey: "Header-Key")
    .add(parameter: "ParamValue", forKey: "ParamKey")
    .byJSON { (response, json) in
        guard let json = json else { return }
        // handle with SwiftyJSON object
        NSLog("(json["headers"]["Common-Key"].stringValue)")
        NSLog("(json["headers"]["Header-Key"].stringValue)")
        NSLog("(json["json"]["ParamKey"].stringValue)")
    }

// Or by Data?
CustomNetworkRequester(.post, urlString: "https://httpbin.org/post")
    .add(header: "HeaderValue", forKey: "Header-Key")
    .add(parameter: "ParamValue", forKey: "ParamKey")
    .byData { (response) in
        if let data = response.value {
           // do your job
        }
    }

Installation

OptionalTypes is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "NetworkRequester"

Unlicense

Do whatever you want with this code.

Latest podspec

{
    "name": "NetworkRequester",
    "version": "1.1.0",
    "summary": "Simple and customizable network library to use in iOS application project.",
    "description": "Supports both customization for common network configuration and easy-to-use requester creation mechanism.",
    "homepage": "https://github.com/DragonCherry/NetworkRequester",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "DragonCherry": "[email protected]"
    },
    "source": {
        "git": "https://github.com/DragonCherry/NetworkRequester.git",
        "tag": "1.1.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "NetworkRequester/Classes/**/*",
    "dependencies": {
        "TinyLog": [],
        "Alamofire": [],
        "SwiftyJSON": []
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This