Swiftpack.co - Package - tadija/AENetwork

AENetwork

Swift package for networking

I made this for personal use, feel free to use it or contribute if you like.

Usage

import AENetwork

/// - Note: Convenient creation of request
let request = URLRequest(url: "https://httpbin.org/get")

/// - Note: Fetching with throwable completion closure
let network = Network()
network.fetchDictionary(with: request) { (closure) in
    do {
        let dictionary = try closure()
        print(dictionary)
    } catch {
        print(error)
    }
}

/// - Note: Fetching directly from request (using shared instance)
request.fetchDictionary { (closure) in
    do {
        let dictionary = try closure()
        print(dictionary)
    } catch {
        print(error)
    }
}

For more examples check out Sources and Tests.

Installation

.Package(url: "https://github.com/tadija/AENetwork.git", majorVersion: 0)

License

This code is released under the MIT license. See LICENSE for details.

Github

link
Stars: 0
Help us keep the lights on

Dependencies

Used By

Total: 0