Latest 0.0.1
Homepage https://github.com/thisisdingo/Indigear
License MIT
Platforms ios 9.0
Authors

MIT License Swift 4.2

Indigear is simple library for working with HTTP(s) connections

Installation

Indigear requires CocoaPods.

Installing.

platform :ios, '9.0'
use_frameworks!

pod 'Indigear'

Usage

Making simple GET request

import Indigear

/* YOUR AWESOME CODE */

Indigear.run("http://google.com") { result in
            if result.isSuccess {
                print("Fetched data:", String(data: result.result!, encoding: .utf8))
            }else{
                print("Error:", result.error!.localizedDescription)
            }
        }

Making more complex requests.

        import Indigear

        /* YOUR AWESOME CODE */

        let header : IndigearHeader = ["User-Agent" : "Your Awesome Application"]
        let params = ["param1" : "value1"]

        let requestURL = "http://indigear.michil.ru/index.php" + "?getparam1=value1&getparam=value2"

        Indigear.run(requestURL, method: .post, headers: header, body: params) { result in
            if result.isSuccess {
                do {
                    let result = try JSONSerialization.jsonObject(with: result.result!, options: []) as! [String : Any]

                    print("Request POST parameters: ", result["POST"] ?? "")
                    print("Request GET parameters: ", result["GET"] ?? "")
                    print("Request HEADERS: ", result["HEADERS"] ?? "")

                } catch {
                    print(error)
                }

            }else{
                print("Error: ", result.error!.localizedDescription)
            }
        }

Author

Michil Khabarov – http://michil.ru

LICENSE

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

Latest podspec

{
    "name": "Indigear",
    "version": "0.0.1",
    "summary": "Simple HTTP client for Swift",
    "homepage": "https://github.com/thisisdingo/Indigear",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "": ""
    },
    "platforms": {
        "ios": "9.0"
    },
    "source": {
        "git": "https://github.com/thisisdingo/Indigear.git",
        "tag": "0.0.1"
    },
    "source_files": [
        "Classes",
        "Indigear/**/*.{swift}"
    ],
    "exclude_files": "Classes/Exclude"
}

Pin It on Pinterest

Share This