Swiftpack.co -  helperbug/CodableRequest as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
CodableRequest is a Swift Package that wraps an async URLSession with a JSON Decoder and flattens out REST experience (requires Swift 5.5)
.package(url: "https://github.com/helperbug/CodableRequest.git", from: "0.0.1-alpha")


Helper class that makes it easy to use a REST endpoint with Swift's structured concurrency and codables. There is an implentation for GET that takes an address and decodes the resulting json into a Swift struct. There is a POST implementation that sends an encodable and receives a decoable.

Wrapping all that functionality means the caller has to deal with a large range of possible errors and exceptions. To unify the error path a wrapper Error is used that transcodes framework errors and also generates new types of errors when needed.

See the included test for example codable structs and a couple of tests.

MIT License

Copyright (c) 2021 Ben Waidhofer

Awaitable REST access where the results are decoded into the type specified by the caller.

Structured Generic GET

Caller passes in the codable object that is encoded into binary JSON and set as the http request's body. Results are decoded into the type specified by the caller.

Structured Generic POST


Stars: 0
Last commit: 5 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

Alpha Release 0.0.1
5 weeks ago

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