Swiftpack.co -  rorodriguez116/Rapide as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
A lightweight wrapper library for networking and parsing tasks
.package(url: "https://github.com/rorodriguez116/Rapide.git", from: "0.1.0")


Rapide is a fast and lightweight combine-based wrapper on URLSession. Rapide provides a simple and easy to use API for performing REST request and effortless mapping from and to JSON models, using Swift's native Codable and Decodable protocols.


As an example, we'll perform a get request to the following API: https://openexchangerates.org/api/convert/2000/GBP/EUR?app_id=XYZ

    .execute(.get, decoding: String.self)
    .sink { completion in
        if case let .failure(error) = completion {
            switch error {
            // Handle expected JSON error response from known status code (e.j 420)
            case .expectedErrorWithJSONResponse(let data, let code):
                let decoder = JSONDecoder()
                decoder.decode(data, from: My420JSONType.self)
            default: print(error)
    } receiveValue: { val in
        // success

    .store(in: &self.subscriptions)

The presented code is very easy to read. First we specify the connection scheme we want to use, Rapide offers http, https and ftp. Then we provide the host and path to our API, the parameters we want to pass the API to and we finalize calling execute, which will return a combine publisher that will execute the specified http method and map the response to the provided Codable conforming type.


Stars: 0
Last commit: 2 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.

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