Introducing Macro-powered CombineNetworking

Hello everyone.
I've created a framework to make networking with Combine easier.
So far the latest official build 1.11.0 contains features such as:

  • automatic authorization handlers
  • easy SSL/Certificate pinning
  • easy testing with test() and testRaw()
  • WebSocket connection support
  • automatic access token storage either in Keychain or RAM

Now, thanks to Swift Macros, version 2.0.0-Beta introduces new way of creating and executing network calls. Here's a little sample of how to define an endpoint with all the APIs in it

@Endpoint(url: "https://jsonplaceholder.typicode.com/")
struct TestEndpoint: EndpointModel {
    @GET(url: "todos/1") var todos: EndpointBuilder<Todo>
    @GET(url: "comments") var comments: EndpointBuilder<Data>
    @POST(url: "posts") var post: EndpointBuilder<Data>
}

Executing request is also easy and gives you consistent experience along with Combine.

func callRequest() {
    endpoint
        .comments
        .setRequestParams(.queryParams(["postId": 1]))
        .build()
        .catch { (error) -> Just<Todo?> in
            print(error)
            return Just(nil)
        }
        .assign(to: \.todo, on: self)
        .store(in: &subscriptions)
}

If you want to learn more and give it a try, you can find it here:

All the feedback is more than welcome :slight_smile:

1 Like