Swiftpack.co - OliverLetterer/GracefulNetworking as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by OliverLetterer.
OliverLetterer/GracefulNetworking 0.5.2
HTTP Networking in Swift.
⭐️ 0
🕓 3 weeks ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/OliverLetterer/GracefulNetworking.git", from: "0.5.2")

Graceful Networking

Elegant Networking in Swift

Platforms Swift Swift Package Manager

Based on AsyncHTTPClient.

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. It is in early development, but Graceful Networking does support its use on supported platforms.

Once you have your Swift package set up, adding Graceful Networking as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/OliverLetterer/GracefulNetworking.git", .upToNextMajor(from: "0.1.0"))


Graceful Networking is slightly inspired by github.com/Alamofire/Alamofire.

Making requests

NN.shared.get("https://jsonplaceholder.typicode.com/posts").response { response, error in
struct PostResponse: Codable {
    var id: Int
    var title: String
    var body: String
    var userId: String

let parameters: [String: NNWWWURLFormEncodable] = [
    "title": "title",
    "body": "body",
    "userId": "5"

NN.shared.post("https://jsonplaceholder.typicode.com/posts", parameters: parameters).responseDecodable(of: PostResponse.self) { response, error in

Downloading data to a file

let url = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("image.png")
NN.shared.download("https://httpbin.org/image/png", destination: url) { respose, error in


Stars: 0
Last commit: 3 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics