Swiftpack.co - brennobemoura/request-dl as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by brennobemoura.
brennobemoura/request-dl v1.0.3
The Property protocol in RequestDL allows developers to customize URLRequest properties using a struct specification or the PropertyBuilder, making it easy to meet specific request requirements.
⭐️ 59
🕓 2 days ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/brennobemoura/request-dl.git", from: "v1.0.3")

Swift Compatibility Platform Compatibility Tests Test Coverage


RequestDL is a Swift package designed to simplify the process of performing network requests. It provides a set of tools, including the Task protocol, which supports different types of requests, including DataTask, DownloadTask, and BytesTask.

One of the key features of RequestDL is its support for specifying properties of a URLRequest, such as Query, Payload, and Headers, among others. You can also use TaskModifier and TaskInterceptor to process the response after the request is complete, allowing for actions like decoding, mapping, error handling based on status codes, and logging responses in the console.

RequestDL's Property protocol is another powerful feature that allows developers to implement custom properties to define various aspects of the URLRequest within a struct specification or using the @PropertyBuilder. This makes it easy to customize requests to meet specific needs.


RequestDL can be installed using Swift Package Manager. To include it in your project, add the following dependency to your Package.swift file:

dependencies: [
    .package(url: "https://github.com/brennobemoura/request-dl.git", from: "1.0.0")


Using RequestDL is easy and intuitive. You can create network requests in a declarative way, specifying the properties of the request through the use of the Property protocol or using the @PropertyBuilder attribute.

Here's an example of a simple DataTask that queries Google for the term "apple", logs the response in the console, and ignores the URLResponse:

try await DataTask {
    HeaderGroup {
    Query("apple", forKey: "q")

This code creates a DataTask with the BaseURL set to "google.com", a HeaderGroup containing the "Accept" and "Content-Type" headers set to "application/json", and a query parameter with the key "q" and the value "apple". It then sets the logInConsole property to true, which will print the response in the console when the request is completed. It also decodes the response into an instance of GoogleResponse and then ignores it.

This is just a simple example of what RequestDL can do. Check out the documentation for more information on how to use it.


If you find a bug or have an idea for a new feature, please open an issue or submit a pull request. We welcome contributions from the community!


This library owes a lot to the work of Carson Katri and his Swift package Request. Many of the core concepts and techniques used in RequestDL were inspired by Carson's library, and the original implementation of RequestDL even used a fork of Carson's library as its foundation.

Without Carson's work, this library would not exist in its current form. Thank you, Carson, for your contributions to the Swift community and for inspiring the development of RequestDL.


Stars: 60
Last commit: 10 hours ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

Release 1.0.3
2 days ago

What’s Changed

🚀 Enhancements

  • Added throws in Property initialization (#37) @brennobemoura

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