HTTPNetworkClient: A Lightweight Swift Package for Typed REST API Networking

Hello Everyone,

Recently, I happened to write a new Swift Package Manager package that makes it easier to build more structured and scalable APIs for HTTP communication between client and server.

HTTPNetworkClient is a lightweight Swift package that helps you build a clean and testable networking layer for REST APIs. It uses typed APIRequest definitions, a shared RequestBuilder for base URLs and headers, and an async/await-powered HTTP client, while still allowing custom URLSession and JSONDecoder injection when needed.

The package supports both iOS and macOS, and aims to keep API integration simple, explicit, and easy to maintain without adding unnecessary abstraction. It is a small utility for Swift developers who want structured request modeling, predictable error handling, and a straightforward foundation for network-driven apps.

Please let me know what you think.

GitHub Link

1 Like

Nice job, It was actually funny that I have been working on the exact problem, making Server/Client communication type safe :smiley: and I have just released a package called TSCommunication, that cover all of these stuff.

Make sure to check it out and give me feedback. In the meantime I will take a look at your version​:victory_hand:t2::smiley:

Ok, I took a look at your code, First of all it is very well documented :victory_hand:t2:, well done.

If I were you:

  1. I would have just extended URLSession itself be an APIClient, this would be also way easier to use.
  2. I would have provided a MockClient for testing ( as you did in your tests :smiley:)
  3. I would have add more cases to HTTPMethod enum.

Hope these help :victory_hand:t2::smiley: