Swiftpack.co - marinofelipe/http_client as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by marinofelipe.
marinofelipe/http_client 0.0.4
🌐(🚜) Easy to use HTTPClient(s) built on top of URLSession and available for Combine
⭐️ 2
🕓 3 years ago
iOS macOS
.package(url: "https://github.com/marinofelipe/http_client.git", from: "0.0.4")

🌐🚜 (Combine)HTTPClient

Swift 5.2 Swift Package Manager @_marinofelipe

Simple HTTPClient(s) built on top of URLSession.

Motivation

There are a lot of great open sourced and community-driven third-party networking libraries, such as Moya and Alamofire. They are quite powerfull, can speed up development, and help you on different and more complex ways of networking.

For some use cases though I like the idea of something simpler, without the need to rely on yet another third party dependency. It's also a lot of fun to learn more about networking 😝.

This project is an example on how to wrap URLSession, and provide an easy to use but still robust and well-tested API. Same concept can be applied over any other SDKs, even when using a third-party library, since it's always a good practice to do not expose such logic to the outside world, making it easier to maintain and swap implementation in the future.

Content

It comes with these array of libraries: [HTTPClient, CombineHTTPClient, CombineHTTPClientTestSupport]

Examples on how to use can them can taken seen in the unit tests 😉. Both clients depends on HTTPClientCore, which contains shared helpers and common types.

Installation

Swift Package Manager

If you want to try it out in a project that uses SPM, just add it as a dependency in your Package.swift:

dependencies: [
  .package(url: "https://github.com/marinofelipe/http_client.git", from: "0.0.1")
]

License

All modules are released under the MIT license. See LICENSE for details.

GitHub

link
Stars: 2
Last commit: 3 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Dependencies

Release Notes

Tiny tiny patch
3 years ago
  • Just some syntax improvements suggested by @pietrocaselani.

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