Swiftpack.co - tdeleon/Relax as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by tdeleon.
tdeleon/Relax 2.1.0
Declaratively build and send client requests for REST APIs in Swift.
⭐️ 7
🕓 3 weeks ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/tdeleon/Relax.git", from: "2.1.0")

Relax


License Swift SwiftPM Platforms Test

Declaratively build and send client requests for REST APIs in Swift.

Overview

Relax provides a way to declaratively define and organize client HTTP requests for REST APIs. The framework is lightweight built on protocols, easily allowing you to structure your requests for even the most complex REST APIs.

Full Reference Documentation

https://swiftpackageindex.com/tdeleon/Relax/2.1.0/documentation/relax

Features

  • Lightweight: built on protocols, works directly on URLSession for low overhead
  • Declarative syntax: using result builders, allows for quickly and easily organizing requests to match any structure of REST API.
  • Modern: Supports Swift concurrency (async/await) and Combine (on Apple platforms).

Supported Platforms

Available for all Swift (5.7+) platforms, including:

Platform Minimum Version
macOS 12.0
iOS 14.0
watchOS 7.0
tvOS 14.0
Linux Swift 5.7*
Windows Swift 5.7*

*Works on any version where Swift 5.7 is supported.

Getting Started

Relax supports the Swift Package Manager. To integrate in your project-

  1. Add the following to the package dependencies in the Package.swift manifest file:

    dependencies: [
        .package(url: "https://github.com/tdeleon/Relax.git", from: "2.0.0")
    ]
    
  2. Add Relax to the target dependencies:

    targets: [
        .target(
            name: "YourProject",
            dependencies: ["Relax"])
    ]
    

In files where you will be using Relax, import the framework:

import Relax

Make a Simple Request

do {
    let request = Request(.get, url: URL(string: "https://example.com/users")!)
    try await request.send()
} catch {
    print(error)
}

To get started using Relax, see the full documentation.

GitHub

link
Stars: 7
Last commit: 3 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

2.1.0
3 weeks ago

What's Changed

  • #13 - Add support for dictionaries in Body
  • #14 - Add better overview examples in documentation
  • #15 - RequestBuilder buildBlock method was not public

Full Changelog: https://github.com/tdeleon/Relax/compare/2.0.0...2.1.0

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